Apktool
Apktool copied to clipboard
[BUG]Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file
Information
-
Apktool Version (
apktool -version
) -2.6.1 - Operating System (Mac, Linux, Windows) -Mac
- APK From? (Playstore, ROM, Other) -Other
Stacktrace/Logcat
apktool d -f -s xxxx.apk
I: Using Apktool 2.6.1 on xxxx.apk
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:55)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:783)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:64)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:56)
at brut.androlib.Androlib.getResTable(Androlib.java:70)
at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:247)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:109)
at brut.apktool.Main.cmdDecode(Main.java:175)
at brut.apktool.Main.main(Main.java:79)
Caused by: java.io.IOException: Expected: 0x00000008, got: 0x00000003
at brut.util.ExtDataInput.skipCheckShort(ExtDataInput.java:53)
at brut.androlib.res.decoder.ARSCDecoder.readValue(ARSCDecoder.java:360)
at brut.androlib.res.decoder.ARSCDecoder.readEntryData(ARSCDecoder.java:285)
at brut.androlib.res.decoder.ARSCDecoder.readTableType(ARSCDecoder.java:261)
at brut.androlib.res.decoder.ARSCDecoder.readTableTypeSpec(ARSCDecoder.java:184)
at brut.androlib.res.decoder.ARSCDecoder.readTablePackage(ARSCDecoder.java:135)
at brut.androlib.res.decoder.ARSCDecoder.readTableHeader(ARSCDecoder.java:84)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:50)
... 8 more
Steps to Reproduce
-
apktool
Frameworks
If this APK is from an OEM ROM (Samsung, HTC, LG). Please attach framework files
(.apks
that live in /system/framework
or /system/priv-app
)
APK
Questions to ask before submission
- Have you tried
apktool d
,apktool b
without changing anything? yes - If you are trying to install a modified apk, did you resign it? no
- Are you using the latest apktool version? yes
...
Confirmed. Marking as bug. Must be a new iteration of sparse resources or a new type.
https://download.moutai519.com.cn/mt-download/app/v1/imoutai.apk @dishcheng 请问解决了么,兄弟。
https://download.moutai519.com.cn/mt-download/app/v1/imoutai.apk @dishcheng 请问解决了么,兄弟。
沒辦法
@dishcheng 我刚开始弄,寻思研究研究,jar拿到了,没资源文件不行啊。刚用2.6.0试试,发现还是不行。再往前退版本,你试了么。是因为没有框架文件么?
@iBotPeaches I have the same problem,How should I solve it,thanks
Same issue even with version 2.7
In case it helps same stack trace also occurs on TTlock apk: https://m.apkpure.com/ttlock/com.tongtongsuo.app
An interesting technique. It seems we have a duplicate resource at the end of the chunk with no corresponding value. Its quite small and Apktool made an assumption that it would always have a ResValue if a non-empty specId was encountered.
[ResTable_entry] id: 0x0596 name: zoom keyIndex: 5177 size: 8 flags: 0x0004
[Res_value] size: 8 dataType: 0x12 data: 0x00000000 ((id))
[ResTable_entry] id: 0x0597 name: zoom keyIndex: 5177 size: 8 flags: 0x0004
[Res_value] size: 3 dataType: 0x12 data: 0x00000000 ((id))
You can see the last style is only size 3. So we can design a patch to skip value reading and return null if the size is small.
➜ 2824 apktool d imoutai.apk -s -f
I: Using Apktool v2.8.1-54-7405e504-SNAPSHOT on imoutai.apk
I: Loading resource table...
W: Unknown data detected. Skipping: 6 byte(s)
I: Decoding file-resources...
I: Loading resource table from file: /home/ibotpeaches/.local/share/apktool/framework/1.apk
I: Decoding values */* XMLs...
I: Decoding AndroidManifest.xml with resources...
I: Regular manifest package...
I: Copying raw classes.dex file...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I: Copying META-INF/services directory
➜ 2824 vim imoutai/AndroidManifest.xml
➜ 2824 apktool b imoutai --use-aapt2
I: Using Apktool v2.8.1-54-7405e504-SNAPSHOT
I: Copying imoutai classes.dex file...
I: Checking whether resources has changed...
I: Building resources...
I: Copying libs... (/lib)
I: Copying libs... (/kotlin)
I: Copying libs... (/META-INF/services)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk into: imoutai/dist/imoutai.apk
➜ 2824
PR above will close this once merged.