diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3f2aedd..986d828 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/APKToolGUI/ApkTool/ApkFixer.cs b/APKToolGUI/ApkTool/ApkFixer.cs index 4b18b2d..cac62fe 100644 --- a/APKToolGUI/ApkTool/ApkFixer.cs +++ b/APKToolGUI/ApkTool/ApkFixer.cs @@ -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; diff --git a/APKToolGUI/ApkTool/Apktool.cs b/APKToolGUI/ApkTool/Apktool.cs index 0e667ac..b119a3f 100644 --- a/APKToolGUI/ApkTool/Apktool.cs +++ b/APKToolGUI/ApkTool/Apktool.cs @@ -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; @@ -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); @@ -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; @@ -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); diff --git a/APKToolGUI/Forms/FormMain.cs b/APKToolGUI/Forms/FormMain.cs index 41eb619..3e278d9 100644 --- a/APKToolGUI/Forms/FormMain.cs +++ b/APKToolGUI/Forms/FormMain.cs @@ -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 ParseApkInBackgroundAsync(string file, string splitPath) @@ -1235,7 +1238,7 @@ internal async Task 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"; @@ -1716,4 +1719,4 @@ private void apkIconPicBox_Click(object sender, EventArgs e) } } } -} \ No newline at end of file +} diff --git a/APKToolGUI/Handlers/DragDropHandlers.cs b/APKToolGUI/Handlers/DragDropHandlers.cs index a16b423..e845672 100644 --- a/APKToolGUI/Handlers/DragDropHandlers.cs +++ b/APKToolGUI/Handlers/DragDropHandlers.cs @@ -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); } diff --git a/APKToolGUI/Handlers/MainWindowEventHandlers.cs b/APKToolGUI/Handlers/MainWindowEventHandlers.cs index ba9e274..593f4da 100644 --- a/APKToolGUI/Handlers/MainWindowEventHandlers.cs +++ b/APKToolGUI/Handlers/MainWindowEventHandlers.cs @@ -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)) diff --git a/APKToolGUI/Handlers/SignControlEventHandlers.cs b/APKToolGUI/Handlers/SignControlEventHandlers.cs index 080c6c9..0900aa7 100644 --- a/APKToolGUI/Handlers/SignControlEventHandlers.cs +++ b/APKToolGUI/Handlers/SignControlEventHandlers.cs @@ -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; diff --git a/APKToolGUI/Java/JarProcess.cs b/APKToolGUI/Java/JarProcess.cs index e2072f0..4f9a5a6 100644 --- a/APKToolGUI/Java/JarProcess.cs +++ b/APKToolGUI/Java/JarProcess.cs @@ -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(); } @@ -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(); } diff --git a/APKToolGUI/Utils/DragDropUtils.cs b/APKToolGUI/Utils/DragDropUtils.cs index 9e12f82..f3ce0d2 100644 --- a/APKToolGUI/Utils/DragDropUtils.cs +++ b/APKToolGUI/Utils/DragDropUtils.cs @@ -38,6 +38,12 @@ public static string[] GetFilesDrop(this DragEventArgs args, Func 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))) @@ -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; @@ -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])) { @@ -87,6 +104,9 @@ public static bool CheckManyDragOver(this DragEventArgs e, params string[] exten public static bool DropOneByEnd(this DragEventArgs e, Action onSuccess, params string[] extensions) { string[] files = e.GetFilesDrop(); + if (files.Length == 0) + return false; + if (extensions == null && Directory.Exists(files[0])) { onSuccess(files[0]); @@ -103,6 +123,9 @@ public static bool DropOneByEnd(this DragEventArgs e, Action onSuccess, public static bool DropManyByEnd(this DragEventArgs e, Action onSuccess, params string[] extensions) { + if (extensions == null || extensions.Length == 0) + return false; + foreach (string apk in extensions) { Debug.WriteLine(apk); diff --git a/README.md b/README.md index 6077ac9..fa02ef7 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/Tools/APKEditor.jar b/Tools/APKEditor.jar index 25f8858..f1a0d81 100644 Binary files a/Tools/APKEditor.jar and b/Tools/APKEditor.jar differ diff --git a/Tools/AdbWinApi.dll b/Tools/AdbWinApi.dll index 1da794e..56d91e9 100644 Binary files a/Tools/AdbWinApi.dll and b/Tools/AdbWinApi.dll differ diff --git a/Tools/AdbWinUsbApi.dll b/Tools/AdbWinUsbApi.dll index 7f75aec..9cdb85c 100644 Binary files a/Tools/AdbWinUsbApi.dll and b/Tools/AdbWinUsbApi.dll differ diff --git a/Tools/adb.exe b/Tools/adb.exe index 34a0fd2..518cf6d 100644 Binary files a/Tools/adb.exe and b/Tools/adb.exe differ diff --git a/Tools/apktool.jar b/Tools/apktool.jar index ec66018..d5865a7 100644 Binary files a/Tools/apktool.jar and b/Tools/apktool.jar differ diff --git a/changelog.txt b/changelog.txt index f73c30e..83aa76d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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