Skip to content

Download binary dependencies automatically#201

Merged
vaibhavpandeyvpz merged 10 commits into
masterfrom
VPZ/auto-get-binaries
Dec 3, 2025
Merged

Download binary dependencies automatically#201
vaibhavpandeyvpz merged 10 commits into
masterfrom
VPZ/auto-get-binaries

Conversation

@vaibhavpandeyvpz
Copy link
Copy Markdown
Owner

@vaibhavpandeyvpz vaibhavpandeyvpz commented Dec 3, 2025

Fix Tool Detection, Download Dialog, and macOS Build Issues

Summary

This PR fixes critical issues with tool version detection on Windows, improves the download dialog UX, corrects Apktool build flags, replaces external styling with Qt 6 native themes, and resolves macOS bundle configuration issues.

Changes

🔧 Fixed JADX Version Detection on Windows

Problem: JADX version detection failed because .bat files cannot be executed directly via QProcess.

Solution:

  • Modified ProcessUtils::runCommand() to detect .bat/.cmd files and wrap them with cmd.exe /c
  • Set working directory to batch file's directory for proper path resolution
  • Automatically configure JAVA_HOME and PATH environment variables for batch files requiring Java

Files Changed:

  • sources/processutils.cpp

🐛 Fixed Download Dialog Showing "Cancelled" After Success

Problem: Clicking "Close" after successful downloads incorrectly showed "Download cancelled" message.

Solution:

  • Added completion check in handleCancel() and closeEvent() to detect successful completion
  • Accept dialog normally when downloads are complete instead of showing cancellation message

Files Changed:

  • sources/tooldownloaddialog.cpp

🔨 Fixed Apktool Build Flag

Problem: Apktool 2.12.1+ uses aapt2 by default and doesn't support --use-aapt2 flag.

Solution:

  • Removed --use-aapt2 flag (aapt2 is default)
  • Only add --use-aapt1 flag when aapt1 is explicitly requested

Files Changed:

  • sources/apkrecompileworker.cpp

🎨 Replaced External Styling with Qt 6 Native Themes

Problem: Using external QDarkStyleSheet library added unnecessary dependency.

Solution:

  • Removed QDarkStyleSheet submodule
  • Use Qt 6 native Fusion style with app.setStyle("Fusion")
  • Use Qt 6.5+ setColorScheme() API for dark/light themes (with fallback for older versions)

Files Changed:

  • sources/main.cpp
  • CMakeLists.txt
  • Removed: sources/darkstyle.*, sources/lightstyle.*, sources/stylecommon.*

🍎 Fixed macOS Build Issues

Problem: App showed as "ApkStudio" instead of "APK Studio", missing icon in dock/DMG, and launch issues.

Solution:

  • Added CFBundleDisplayName set to "APK Studio" in Info.plist
  • Added CFBundleIconName and proper icon resource handling
  • Added NSPrincipalClass and LSApplicationCategoryType for proper app initialization
  • Renamed bundle to "APK Studio.app" in DMG for correct display
  • Enhanced icon handling with verification and proper resource copying

Files Changed:

  • CMakeLists.txt (Info.plist generation and icon handling)
  • .github/workflows/build.yml (DMG creation with proper bundle naming)

🛠️ Enhanced Debug Logging

  • Wrapped all qDebug() calls in #ifdef QT_DEBUG blocks
  • Added comprehensive debug logging for JADX version detection

Files Changed:

  • sources/versionresolveworker.cpp
  • sources/processutils.cpp
  • sources/tooldownloadworker.cpp
  • sources/apkdecompileworker.cpp
  • sources/adbinstallworker.cpp
  • sources/apksignworker.cpp
  • sources/apkrecompileworker.cpp

Technical Details

Batch File Execution on Windows

The implementation correctly handles Windows batch files by:

  1. Detecting .bat and .cmd file extensions
  2. Wrapping execution with cmd.exe /c in correct order
  3. Setting working directory to batch file's directory
  4. Configuring environment variables (JAVA_HOME, PATH) for tools requiring Java

Qt 6 Native Theming

  • Uses Qt 6.5+ QStyleHints::setColorScheme() API when available
  • Falls back to manual palette configuration for Qt 6.0-6.4
  • No external dependencies required

macOS Bundle Configuration

  • Proper Info.plist with CFBundleDisplayName for user-facing name
  • Icon properly embedded in bundle Resources directory
  • Bundle renamed in DMG for correct Finder display

Testing

Manual Testing Performed

  1. ✅ JADX version detection works correctly on Windows
  2. ✅ Download dialog closes properly after successful completion
  3. ✅ Apktool build works with both aapt1 and aapt2
  4. ✅ Dark/light theme switching works with Qt 6 native styling
  5. ✅ macOS app launches correctly with proper name and icon
  6. ✅ macOS DMG shows "APK Studio" with correct icon

Impact

  • User Experience: Windows users can now properly detect JADX and other batch-based tools
  • UI/UX: Download dialog provides correct feedback, themes work natively
  • macOS: App displays correctly with proper name and icon in all contexts
  • Code Quality: Removed external dependency, cleaner codebase, proper debug logging
  • Maintainability: Better error handling and logging for troubleshooting

Related Issues

Fixes issues with:

  • JADX version detection failing on Windows
  • Download dialog showing incorrect "cancelled" message
  • Apktool build failing with --use-aapt2 flag
  • macOS app showing wrong name and missing icon
  • External styling library dependency

@vaibhavpandeyvpz vaibhavpandeyvpz merged commit 455ccee into master Dec 3, 2025
3 checks passed
@vaibhavpandeyvpz vaibhavpandeyvpz deleted the VPZ/auto-get-binaries branch December 3, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant