Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource-only apk is not decoded #1517

Closed
therealchjones opened this issue Jun 7, 2022 · 2 comments · Fixed by #1530
Closed

Resource-only apk is not decoded #1517

therealchjones opened this issue Jun 7, 2022 · 2 comments · Fixed by #1530
Labels
bug CLI Issues in jadx-cli module regression
Milestone

Comments

@therealchjones
Copy link
Contributor

From 1.3.4 (specifically 54683e3), the addition of

LOG.error("Load failed! No classes for decompile!");
leads to failure to process resource-only apks (e.g., those without java files such as architecture-dependent split apks), even when the --no-src option is given.

In 1.3.3:

% bin/jadx -v -d output/armeabi_v7a config.armeabi_v7a.apk
DEBUG - Effective jadx args: JadxArgs{inputFiles=[config.armeabi_v7a.apk], outDir=output/armeabi_v7a, outDirSrc=output/armeabi_v7a/sources, outDirRes=output/armeabi_v7a/resources, threadsCount=8, cfgOutput=false, rawCFGOutput=false, fallbackMode=false, showInconsistentCode=false, useImports=true, skipResources=false, skipSources=false, deobfuscationOn=false, deobfuscationMapFile=null, deobfuscationMapFileMode=READ, useSourceNameAsClassAlias=false, parseKotlinMetadata=false, useKotlinMethodsForVarNames=APPLY, deobfuscationMinLength=3, deobfuscationMaxLength=64, escapeUnicode=false, replaceConsts=true, respectBytecodeAccModifiers=false, exportAsGradleProject=false, fsCaseSensitive=false, renameFlags=[CASE, VALID, PRINTABLE], outputFormat=JAVA, commentsLevel=INFO, codeCache=NoOpCodeCache, codeWriter=SimpleCodeWriter, useDxInput=false}
INFO  - loading ...
DEBUG - Loading plugin: java-convert
DEBUG - Loading plugin: smali-input
DEBUG - Loading plugin: dex-input
DEBUG - Loading plugin: java-input
DEBUG - Resolved plugins: [dex-input, java-input, smali-input]
DEBUG - Loaded using 0 inputs plugin
INFO  - Loaded classes: 0, methods: 0, instructions: 0
DEBUG - Clst file loaded in 134ms, classes: 4750, methods: 48272
DEBUG - '.arsc' file not found
DEBUG - SignatureProcessor time: 0ms
DEBUG - OverrideMethodVisitor time: 0ms
DEBUG - Deobfuscation map file set to: config.armeabi_v7a.jobf
DEBUG - RenameVisitor time: 2ms
DEBUG - UsageInfoVisitor time: 3ms
DEBUG - ProcessAnonymous time: 0ms
DEBUG - ProcessMethodsForInline time: 0ms
DEBUG - Kotlin Intrinsics class not found
DEBUG - processing threads count: 8
INFO  - processing ...
DEBUG - Build decompilation batches in 2ms
DEBUG - Loaded android attributes count: 158
INFO  - done

In 1.4.1:

% bin/jadx -v -d output/armeabi_v7a config.armeabi_v7a.apk 
DEBUG - Effective jadx args: JadxArgs{inputFiles=[config.armeabi_v7a.apk], outDir=output/armeabi_v7a, outDirSrc=output/armeabi_v7a/sources, outDirRes=output/armeabi_v7a/resources, threadsCount=8, decompilationMode=AUTO, showInconsistentCode=false, useImports=true, skipResources=false, skipSources=false, includeDependencies=false, deobfuscationOn=false, deobfuscationMapFile=null, deobfuscationMapFileMode=READ, useSourceNameAsClassAlias=false, parseKotlinMetadata=false, useKotlinMethodsForVarNames=APPLY, insertDebugLines=false, extractFinally=true, deobfuscationMinLength=3, deobfuscationMaxLength=64, escapeUnicode=false, replaceConsts=true, respectBytecodeAccModifiers=false, exportAsGradleProject=false, fsCaseSensitive=false, renameFlags=[CASE, VALID, PRINTABLE], outputFormat=JAVA, commentsLevel=INFO, codeCache=NoOpCodeCache, codeWriter=SimpleCodeWriter, useDxInput=false, pluginOptions={}, cfgOutput=false, rawCFGOutput=false}
INFO  - loading ...
DEBUG - Loading plugin: java-convert
DEBUG - Loading plugin: smali-input
DEBUG - Loading plugin: dex-input
DEBUG - Loading plugin: java-input
DEBUG - Resolved plugins: [dex-input, java-input, smali-input]
DEBUG - Loaded using 0 inputs plugin in 10 ms
INFO  - Loaded classes: 0, methods: 0, instructions: 0
DEBUG - Clst file loaded in 149ms, classes: 5079, methods: 50746
DEBUG - '.arsc' file not found
DEBUG - SignatureProcessor time: 0ms
DEBUG - OverrideMethodVisitor time: 0ms
DEBUG - Deobfuscation map file set to: /Users/chjones/Downloads/jadx/config.armeabi_v7a.jobf
DEBUG - RenameVisitor time: 2ms
DEBUG - UsageInfoVisitor time: 2ms
DEBUG - ProcessAnonymous time: 0ms
DEBUG - ProcessMethodsForInline time: 0ms
DEBUG - Kotlin Intrinsics class not found
ERROR - Load failed! No classes for decompile!

I'd like a way to at least enable the previous behavior, perhaps when the --no-src option is given, or perhaps offer a warning but not an error when no classes are identified. Happy to work on this if desired.

@skylot
Copy link
Owner

skylot commented Jun 7, 2022

@therealchjones sorry about such regression 😢

offer a warning but not an error when no classes are identified

I think this is the best way to handle this: log warning and continue, may omit warning if --no-src option is given.
Also, I definitely need a test for this, or I may accidentally break that again.

Happy to work on this if desired.

Sure! PR is welcome.

@skylot skylot added bug CLI Issues in jadx-cli module regression labels Jun 7, 2022
@skylot skylot added this to the TBD milestone Jun 7, 2022
@therealchjones
Copy link
Contributor Author

My apologies for the delay. Minutes to change the code, then 2 days to figure out how to create an APK that doesn't have any Java code. 🤦

skylot pushed a commit that referenced this issue Jun 11, 2022
* Process resource-only inputs
* Fix error, add testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug CLI Issues in jadx-cli module regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants