Describe the bug
Resource XML files are only partially decoded. aapt2 reports 579 layout/* resources in resources.arsc, but apkeditor d only writes 303 of them as XML under resources/package_1/res/layout/. The remaining 276 are not decoded at all — they are kept as raw (binary) files under root/res/alias_<hash> and only referenced from path-map.json and resources/package_1/res/values/layouts.xml:
resources/package_1/res/values/layouts.xml
<layout name="ime_inputview_root">res/Zy.xml</layout>
path-map.json
{ "name": "res/Zy.xml", "alias": "res/alias_1f76152b" }
So no data is lost, but the XML is not decoded (it stays AXML). Nothing is printed on the console — it fails silently.
The set of files that do get decoded looks arbitrary: it is not split by resource-id range, not by package (there is only 0x7f), and not by "file referenced by several resources". Decoded and missing entries are interleaved.
To Reproduce
- Used version: 1.4.9 (
apkeditor.jar, 7.61 MB)
- Operating system: Windows 11 x64 (the bug is in pure Java, so it should reproduce on any OS)
- Command:
java -jar APKEditor.jar d -i apkeditor_repro_min.apk -o out
Then check the numbers:
# resources.arsc declares 579 layout resources:
aapt2 dump resources apkeditor_repro_min.apk | grep ' layout/' | wc -l
# -> 579
# apkeditor only decoded 303 of them:
ls out/resources/package_1/res/layout | wc -l
# -> 303
# the other 276 are kept as raw AXML (not decoded):
ls out/root/res/alias_*
Log/Stacktrace
No error or warning is printed (this is the main problem — it is silent):
I: [DECOMPILE] Loading resource table...
I: [DECOMPILE] Decoding value resources...
I: [DECOMPILE] Loading resource table from file: ...\framework\1.apk
I: [DECOMPILE] Decoding file resources...
I: [DECOMPILE] Generating values XMLs...
I: [DECOMPILE] Decoding AndroidManifest.xml with resources...
I: [DECOMPILE] Copying original files...
I: [DECOMPILE] Copying assets...
I: [DECOMPILE] Copying lib...
I: [DECOMPILE] Copying unknown files...
I: [DECOMPILE] Saved to: out
Used apk file
apkeditor_repro_min.apk (1.5 MB) — attached.
It is a trimmed version of a real APK (only AndroidManifest.xml + resources.arsc + res/**; dex/assets/lib removed) and it reproduces exactly the same behaviour as the full APK. The resource table and all res/ files are byte-identical to the original.
Additional context
aapt2 dump xmltree apkeditor_repro_min.apk --file res/Zy.xml decodes one of the missing files fine → the file itself is a valid binary XML; it is apkeditor's decoder that skips it.
apkeditor d -keep-res-path shows that all res files are present (res-files/res/…) — so this is not a "file is missing from the APK" problem.
- Examples of missing resources (all present in
resources.arsc):
layout/ime_inputview_root (res/Zy.xml), layout/layout_image_key, layout/view_candidate_list, layout/abc_action_bar_up_container, layout/ime_onehand_left, …
- The APK uses resource path obfuscation: the files on disk are
res/Zy.xml, res/GF.xml, res/-B.xml, … while the resource names in resources.arsc are intact. Maybe the decoder bails out on something in that setup (e.g. sparse type encoding / optimized table)?
- For comparison,
apktool 3.0.3 decodes all 578 entries into res/layout/ on the same APK — so the APK itself is fine.
- Expected: all 579
layout/* resources decoded as XML (or at least a warning/error when some are skipped).
apkeditor_repro_min.zip
Describe the bug
Resource XML files are only partially decoded.
aapt2reports 579layout/*resources inresources.arsc, butapkeditor donly writes 303 of them as XML underresources/package_1/res/layout/. The remaining 276 are not decoded at all — they are kept as raw (binary) files underroot/res/alias_<hash>and only referenced frompath-map.jsonandresources/package_1/res/values/layouts.xml:So no data is lost, but the XML is not decoded (it stays AXML). Nothing is printed on the console — it fails silently.
The set of files that do get decoded looks arbitrary: it is not split by resource-id range, not by package (there is only
0x7f), and not by "file referenced by several resources". Decoded and missing entries are interleaved.To Reproduce
apkeditor.jar, 7.61 MB)Then check the numbers:
Log/Stacktrace
No error or warning is printed (this is the main problem — it is silent):
Used apk file
apkeditor_repro_min.apk(1.5 MB) — attached.It is a trimmed version of a real APK (only
AndroidManifest.xml+resources.arsc+res/**; dex/assets/lib removed) and it reproduces exactly the same behaviour as the full APK. The resource table and allres/files are byte-identical to the original.Additional context
aapt2 dump xmltree apkeditor_repro_min.apk --file res/Zy.xmldecodes one of the missing files fine → the file itself is a valid binary XML; it is apkeditor's decoder that skips it.apkeditor d -keep-res-pathshows that all res files are present (res-files/res/…) — so this is not a "file is missing from the APK" problem.resources.arsc):layout/ime_inputview_root(res/Zy.xml),layout/layout_image_key,layout/view_candidate_list,layout/abc_action_bar_up_container,layout/ime_onehand_left, …res/Zy.xml,res/GF.xml,res/-B.xml, … while the resource names inresources.arscare intact. Maybe the decoder bails out on something in that setup (e.g. sparse type encoding / optimized table)?apktool 3.0.3decodes all 578 entries intores/layout/on the same APK — so the APK itself is fine.layout/*resources decoded as XML (or at least a warning/error when some are skipped).apkeditor_repro_min.zip