Skip to content

Conversation

Copy link

Copilot AI commented Dec 11, 2025

The wrapper scripts were failing with "Unrecognized option: -JXmx6144M" because:

  • Windows wrapper didn't parse -J prefixed JVM options at all
  • Linux/OSX wrappers only parsed -J options at the start of arguments, not at the end
  • All wrappers defaulted to 1GB heap, insufficient for large APK decompilation

Changes

Linux/OSX wrappers:

  • Parse -J options from any position in argument list using bash arrays
  • Preserve argument quoting with spaces via apktoolArgs+=("$1") and set -- "${apktoolArgs[@]}"
  • Increase default heap: -Xmx1024M-Xmx6144M

Windows wrapper:

  • Add -J option parsing loop using findstr and substring extraction
  • Extract and prepend dash to JVM options: -JXmx2048M-Xmx2048M
  • Increase default heap: -Xmx1024M-Xmx6144M

Workflow:

  • Remove explicit -JXmx6144M flag (now default)

Example

Before:

# Fails with "Unrecognized option: -JXmx6144M"
apktool d app.apk -o output -JXmx6144M

After:

# Works - 6GB is now default
apktool d app.apk -o output

# Works - -J options accepted anywhere
apktool d app.apk -o output -JXmx8192M
Original prompt

La configuracion de memoria se configura en el wrapper de apktool
Decompiling APK with dm2q framework...
Unrecognized option: -JXmx6144M
Apktool 3.0.0-dirty - a tool for reengineering Android apk files
with smali 3.0.9-dev and baksmali 3.0.9-dev
Copyright 2010 Ryszard Wiśniewski brut.alll@gmail.com
Copyright 2010 Connor Tumbleson connor.tumbleson@gmail.com
Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0)
General options:
-q,--quiet Suppress normal output.
-v,--verbose Increase output verbosity.
apktool d|decode [options]
-f,--force Force delete destination directory.
-j,--jobs Set the number of jobs to execute in parallel to .
--keep-broken-res Use if there was an error and some resources were dropped, e.g.
"Invalid config flags detected. Dropping resources", but you
want to decode them anyway, even with errors. You will have to
fix them manually before building.
-l,--lib package:file Use shared library located in .
Can be specified multiple times.
--match-original Keep files closest to original as possible (prevents rebuild).
--no-assets Do not decode assets.
--no-debug-info Do not include debug info in sources (.local, .param, .line, etc.)
-o,--output

Output decoded files to . (default: apk.out)
--only-main-classes Only disassemble the main dex classes (classes[0-9]*.dex) in the root.
--only-manifest Only decode AndroidManifest.xml without resources.
-p,--frame-path Use framework files located in .
-r,--no-res Do not decode resources.
--res-resolve-mode Set the resolve mode for resources to .
Possible values are: 'remove' (default), 'dummy' or 'keep'.
-s,--no-src Do not decode sources.
-t,--frame-tag Use framework files tagged with .
For additional info, see: https://apktool.org
For smali/baksmali info, see: https://github.com/google/smali
Error: Process completed with exit code 1 modifica el workfloe de decompile y conpile


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Dec 11, 2025
Copilot AI and others added 6 commits December 11, 2025 07:43
…t RAM to 6GB

Co-authored-by: Eduardob3677 <212653915+Eduardob3677@users.noreply.github.com>
Co-authored-by: Eduardob3677 <212653915+Eduardob3677@users.noreply.github.com>
…e-dash

Co-authored-by: Eduardob3677 <212653915+Eduardob3677@users.noreply.github.com>
…s wrapper

Co-authored-by: Eduardob3677 <212653915+Eduardob3677@users.noreply.github.com>
Co-authored-by: Eduardob3677 <212653915+Eduardob3677@users.noreply.github.com>
…appers

Co-authored-by: Eduardob3677 <212653915+Eduardob3677@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix memory configuration option in apktool wrapper Fix wrapper scripts to handle -J JVM options anywhere in arguments and increase default heap to 6GB Dec 11, 2025
Copilot AI requested a review from Eduardob3677 December 11, 2025 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants