Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ jobs:
run: mkdir package

- name: Copy essential files to package
shell: pwsh
run: |
cp APKToolGUI/bin/Release/APKToolGUI.exe package/
cp -r APKToolGUI/bin/Release/Resources package/
cp APKToolGUI/bin/Release/*.dll package/
Copy-Item APKToolGUI/bin/Release/APKToolGUI.exe package/
Copy-Item changelog.txt package/Changelog.txt

- name: Create placeholder config.xml
run: New-Item -Path package/ -Name "config.xml" -ItemType "file"
if (Test-Path APKToolGUI/bin/Release/Resources) {
Copy-Item APKToolGUI/bin/Release/Resources package/ -Recurse
}

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions APKToolGUI/ApkTool/ApkFixer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public static bool FixAndroidManifest(string decompilePath)
manifestText = manifestText.Replace("android:manageSpace=\"true\"", "");
manifestText = manifestText.Replace("android:localeConfig=\"@xml/locales_config\"", "");
manifestText = manifestText.Replace("STAMP_TYPE_DISTRIBUTION_APK", "STAMP_TYPE_STANDALONE_APK");
manifestText = manifestText.Replace("android:requiredSplitTypes=\"(.*?)\"", "");
manifestText = manifestText.Replace("android:splitTypes=\"(.*?)\"", "");
manifestText = Regex.Replace(manifestText, @"\s*android:requiredSplitTypes=""[^""]*""", "");
manifestText = Regex.Replace(manifestText, @"\s*android:splitTypes=""[^""]*""", "");

File.WriteAllText(manifestPath, manifestText);
return true;
Expand Down
12 changes: 6 additions & 6 deletions APKToolGUI/ApkTool/Apktool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private void Apktool_Exited(object sender, EventArgs e)

public int Decompile(string inputPath, string outputDir)
{
string keyNoSrc = null, keyNoRes = null, keyForce = null, keyFramePath = null, keyMatchOriginal = null, keyOutputDir = null, onlyMainClasses = null, noDebugInfo = null, keyKeepBrokenRes = null, apiLevel = null;
string keyNoSrc = null, keyNoRes = null, keyForce = null, keyFramePath = null, keyMatchOriginal = null, keyOutputDir = null, onlyMainClasses = null, noDebugInfo = null, keyKeepBrokenRes = null, apiLevel = null, jobs = null;

if (Settings.Default.Decode_NoSrc)
keyNoSrc = DecompileKeys.NoSource;
Expand All @@ -143,10 +143,10 @@ public int Decompile(string inputPath, string outputDir)
if (Settings.Default.Decode_SetApiLevel)
apiLevel = String.Format("{0} {1}", DecompileKeys.ApiLevel, Settings.Default.Decode_ApiLevel);
if (Settings.Default.Decode_SetJobs)
apiLevel = String.Format("{0} {1}", DecompileKeys.Jobs, Settings.Default.Decode_Jobs);
jobs = String.Format("{0} {1}", DecompileKeys.Jobs, Settings.Default.Decode_Jobs);
keyOutputDir = String.Format("{0} \"{1}\"", DecompileKeys.OutputDir, outputDir);

string args = String.Format($"d{keyNoSrc}{keyNoRes}{keyForce}{onlyMainClasses}{noDebugInfo}{keyMatchOriginal}{keyFramePath}{keyKeepBrokenRes}{apiLevel}{keyOutputDir} \"{inputPath}\"");
string args = String.Format($"d{keyNoSrc}{keyNoRes}{keyForce}{onlyMainClasses}{noDebugInfo}{keyMatchOriginal}{keyFramePath}{keyKeepBrokenRes}{apiLevel}{jobs}{keyOutputDir} \"{inputPath}\"");

Log.d("Apktool CMD: " + _jarPath + " " + args);

Expand Down Expand Up @@ -189,7 +189,7 @@ public void Cancel()

public int Build(string inputFolder, string outputFile)
{
string keyForceAll = null, keyAapt = null, keyCopyOriginal = null, noCrunch = null, keyFramePath = null, keyOutputAppPath = null, apiLevel = null, useAapt2 = null, netSecConf = null;
string keyForceAll = null, keyAapt = null, keyCopyOriginal = null, noCrunch = null, keyFramePath = null, keyOutputAppPath = null, apiLevel = null, jobs = null, useAapt2 = null, netSecConf = null;

if (Settings.Default.Build_ForceAll)
keyForceAll = BuildKeys.ForceAll;
Expand All @@ -206,14 +206,14 @@ public int Build(string inputFolder, string outputFile)
if (Settings.Default.Build_SetApiLevel)
apiLevel = String.Format("{0} {1}", BuildKeys.ApiLevel, Settings.Default.Build_ApiLevel);
if (Settings.Default.Build_SetJobs)
apiLevel = String.Format("{0} {1}", BuildKeys.Jobs, Settings.Default.Build_Jobs);
jobs = String.Format("{0} {1}", BuildKeys.Jobs, Settings.Default.Build_Jobs);
if (Settings.Default.Build_UseAapt2)
useAapt2 = BuildKeys.UseAapt2;
if (Settings.Default.Build_NetSecConf)
netSecConf = BuildKeys.NetSecConf;
keyOutputAppPath = String.Format("{0} \"{1}\"", BuildKeys.OutputAppPath, outputFile);

string args = String.Format($"b{keyForceAll}{keyAapt}{keyCopyOriginal}{noCrunch}{keyFramePath}{apiLevel}{useAapt2}{netSecConf}{keyOutputAppPath} \"{inputFolder}\"");
string args = String.Format($"b{keyForceAll}{keyAapt}{keyCopyOriginal}{noCrunch}{keyFramePath}{apiLevel}{jobs}{useAapt2}{netSecConf}{keyOutputAppPath} \"{inputFolder}\"");

Log.d("Apktool CMD: " + _jarPath + " " + args);

Expand Down
11 changes: 7 additions & 4 deletions APKToolGUI/Forms/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,17 @@ internal async Task GetApkInfo(string file)
ToLog(ApktoolEventType.Success, Language.Done);
ToStatus(Language.Done, Resources.done);
}
#if DEBUG
catch (Exception ex)
{
#if DEBUG
ToLog(ApktoolEventType.Warning, Language.ErrorGettingApkInfo + "\n" + ex.ToString());
}
#else
catch (Exception)
{
ToLog(ApktoolEventType.Warning, Language.ErrorGettingApkInfo);
#endif
}
#endif
}

private async Task<ApkParseResult> ParseApkInBackgroundAsync(string file, string splitPath)
Expand Down Expand Up @@ -1235,7 +1238,7 @@ internal async Task<int> Sign(string input)
Running(Language.Signing);

string outputFile = input;
if (Settings.Default.Zipalign_UseOutputDir && !IgnoreOutputDirContextMenu)
if (Settings.Default.Sign_UseOutputDir && !IgnoreOutputDirContextMenu)
outputFile = Path.Combine(Settings.Default.Sign_OutputDir, Path.GetFileName(input));
if (!Settings.Default.Sign_OverwriteInputFile)
outputFile = PathUtils.GetDirectoryNameWithoutExtension(outputFile) + "_signed.apk";
Expand Down Expand Up @@ -1716,4 +1719,4 @@ private void apkIconPicBox_Click(object sender, EventArgs e)
}
}
}
}
}
2 changes: 1 addition & 1 deletion APKToolGUI/Handlers/DragDropHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private async void DropApkToGetInfo(DragEventArgs e)
string apkFile = null;
if (e.DropOneByEnd(file => apkFile = file, apks))
{
main.smaliBrowseInputDirTxtBox.Text = apkFile;
main.fileTxtBox.Text = apkFile;
main.basicInfoTabPage.BackColor = PanelBackColor();
await main.GetApkInfo(apkFile);
}
Expand Down
2 changes: 1 addition & 1 deletion APKToolGUI/Handlers/MainWindowEventHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ internal void SignApkOpenDirBtn_Click(object sender, EventArgs e)
{
string inputFile = Settings.Default.Sign_InputFile;
string outputFile = inputFile;
if (Settings.Default.Zipalign_UseOutputDir)
if (Settings.Default.Sign_UseOutputDir)
outputFile = Path.Combine(Settings.Default.Sign_OutputDir, Path.GetFileName(inputFile));

if (File.Exists(outputFile))
Expand Down
1 change: 0 additions & 1 deletion APKToolGUI/Handlers/SignControlEventHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public SignControlEventHandlers(FormMain Main)
main = Main;
main.button_SIGN_BrowsePublicKey.Click += Button_SIGN_BrowsePublicKey_Click;
main.button_SIGN_BrowsePrivateKey.Click += Button_SIGN_BrowsePrivateKey_Click;
main.button_SIGN_BrowsePrivateKey.Click += Button_SIGN_BrowsePrivateKey_Click;
main.button_SIGN_BrowseInputFile.Click += Button_SIGN_BrowseInputFile_Click;
main.button_SIGN_BrowseOutputFile.Click += Button_SIGN_BrowseOutputFile_Click;
main.schemev1ComboBox.SelectedIndexChanged += SchemeComboBox_SelectedIndexChanged;
Expand Down
7 changes: 4 additions & 3 deletions APKToolGUI/Java/JarProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class JarProcess : Process

public JarProcess(string javaPath, string jarPath)
{
JavaPath = javaPath.Equals("java") ? "" : javaPath;
JavaPath = string.IsNullOrWhiteSpace(javaPath) ? "java" : javaPath;
JarPath = jarPath;
Initialize();
}
Expand All @@ -38,8 +38,9 @@ private void Initialize()
if (Settings.Default.UseCustomJVMArgs)
customArgs = Settings.Default.CustomJVMArgs;

StartInfo.Arguments = String.Format("-jar {0} \"{1}\" {2}", customArgs, JarPath, args);
Debug.WriteLine(String.Format("-jar {0} \"{1}\" {2}", customArgs, JarPath, args));
string jvmArgs = string.IsNullOrWhiteSpace(customArgs) ? string.Empty : customArgs.Trim() + " ";
StartInfo.Arguments = String.Format("{0}-jar \"{1}\" {2}", jvmArgs, JarPath, args);
Debug.WriteLine(StartInfo.Arguments);
return base.Start();
}

Expand Down
25 changes: 24 additions & 1 deletion APKToolGUI/Utils/DragDropUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public static string[] GetFilesDrop(this DragEventArgs args, Func<string, bool>
public static void CheckDragEnter(this DragEventArgs e, params string[] extensions)
{
string[] files = e.GetFilesDrop();
if (files.Length == 0)
{
e.Effect = DragDropEffects.None;
return;
}

if (extensions == null && Directory.Exists(files[0]))
e.Effect = DragDropEffects.Copy;
else if (extensions != null && extensions.Any(ext => files[0].EndsWith(ext, StringComparison.Ordinal)))
Expand All @@ -49,12 +55,18 @@ public static void CheckDragEnter(this DragEventArgs e, params string[] extensio
public static bool CheckDragOver(this DragEventArgs e, params string[] extensions)
{
string[] files = e.GetFilesDrop();
if (files.Length == 0)
{
e.Effect = DragDropEffects.None;
return false;
}

if (extensions == null && Directory.Exists(files[0]))
{
e.Effect = DragDropEffects.Move;
return true;
}
else if (files.Length == 1 && extensions.Any(ext => files[0].EndsWith(ext, StringComparison.Ordinal)))
else if (extensions != null && files.Length == 1 && extensions.Any(ext => files[0].EndsWith(ext, StringComparison.Ordinal)))
{
e.Effect = DragDropEffects.Move;
return true;
Expand All @@ -68,6 +80,11 @@ public static bool CheckDragOver(this DragEventArgs e, params string[] extension
public static bool CheckManyDragOver(this DragEventArgs e, params string[] extensions)
{
string[] files = e.GetFilesDrop();
if (files.Length == 0)
{
e.Effect = DragDropEffects.None;
return false;
}

if (extensions == null && Directory.Exists(files[0]))
{
Expand All @@ -87,6 +104,9 @@ public static bool CheckManyDragOver(this DragEventArgs e, params string[] exten
public static bool DropOneByEnd(this DragEventArgs e, Action<string> onSuccess, params string[] extensions)
{
string[] files = e.GetFilesDrop();
if (files.Length == 0)
return false;

if (extensions == null && Directory.Exists(files[0]))
{
onSuccess(files[0]);
Expand All @@ -103,6 +123,9 @@ public static bool DropOneByEnd(this DragEventArgs e, Action<string> onSuccess,

public static bool DropManyByEnd(this DragEventArgs e, Action<string[]> onSuccess, params string[] extensions)
{
if (extensions == null || extensions.Length == 0)
return false;

foreach (string apk in extensions)
{
Debug.WriteLine(apk);
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ If you remain unsure, you can compile the app yourself or refrain from using it

# Requirements
- Windows 7 32-bit/64-bit and above
- [Java](https://www.java.com/en/) or [JDK](https://www.oracle.com/java/technologies/downloads/) 8 or above. Using latest JDK is not really necessary. Java 8 and 17 (long-term support release) is enough. Use 64-bit version if your system is 64-bit
- [Java](https://www.java.com/en/) or [JDK](https://www.oracle.com/java/technologies/downloads/) 8 or above. Using latest JDK is not really necessary. Java 8 and 25 (long-term support release) is enough. Use 64-bit version if your system is 64-bit
- [.NET Framework 4.8](https://dotnet.microsoft.com/en-us/download/dotnet-framework/net48) (Windows 8 and above already have it preinstalled)

# Features
Expand Down Expand Up @@ -109,7 +109,7 @@ No, these features are also beyond the scope of this tool. I do not support or c
# Development
This project is written in C#

Use Visual Studio 2019 and above. NET Framework 4.8 SDK is required
Use Visual Studio 2022 and above. NET Framework 4.8 SDK is required

# Credits
- AndnixSH
Expand Down
Binary file modified Tools/APKEditor.jar
Binary file not shown.
Binary file modified Tools/AdbWinApi.dll
Binary file not shown.
Binary file modified Tools/AdbWinUsbApi.dll
Binary file not shown.
Binary file modified Tools/adb.exe
Binary file not shown.
Binary file modified Tools/apktool.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
3.3.2.2
- Updated APKEditor to 1.4.7
- Updated Apktool to 3.0.1
- Updated ADB to 37.0.0-14910828

3.3.2.1
- Updated APKEditor to 1.4.5
- Updated Apktool to 2.12.1
Expand Down