Apktool icon indicating copy to clipboard operation
Apktool copied to clipboard

[BUG] Decode fails with "Could not decode arsc file"

Open IgorTrud opened this issue 3 years ago • 4 comments

Information

  1. Apktool Version (apktool -version) - 2.7.0
  2. Operating System (Mac, Linux, Windows) - Windows 10
  3. APK From? (Playstore, ROM, Other) - direct download from author site

Stacktrace/Logcat

java -jar apktool_2.7.0.jar -f decode android-li-arm64-v8a-prod-v6.15.0-Offical.apk
I: Using Apktool 2.7.0 on android-li-arm64-v8a-prod-v6.15.0-Offical.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:56)
        at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:780)
        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:74)
        at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:251)
        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: 0x001c0001, got: 0x4b545353
        at brut.util.ExtDataInput.skipCheckChunkTypeInt(ExtDataInput.java:72)
        at brut.androlib.res.decoder.StringBlock.read(StringBlock.java:42)
        at brut.androlib.res.decoder.ARSCDecoder.readTableHeader(ARSCDecoder.java:79)
        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:51)
        ... 8 more

Steps to Reproduce

  1. apktool decode

Frameworks

(i don't know)

APK

https://disk.yandex.ru/d/xSadE2cL79NIzw

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything?
  2. If you are trying to install a modified apk, did you resign it?
  3. Are you using the latest apktool version?

IgorTrud avatar Feb 09 '23 18:02 IgorTrud

Similar error on Facebook 402.1.0.24.84 APK (latest version downloaded from the Play Store for me):

I: Using Apktool 2.7.0 on base.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:56)
        at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:780)
        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:74)
        at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:251)
        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: 0x0000000b
        at brut.util.ExtDataInput.skipCheckShort(ExtDataInput.java:53)
        at brut.androlib.res.decoder.ARSCDecoder.readValue(ARSCDecoder.java:399)
        at brut.androlib.res.decoder.ARSCDecoder.readEntryData(ARSCDecoder.java:324)
        at brut.androlib.res.decoder.ARSCDecoder.readTableType(ARSCDecoder.java:309)
        at brut.androlib.res.decoder.ARSCDecoder.readTableTypeSpec(ARSCDecoder.java:224)
        at brut.androlib.res.decoder.ARSCDecoder.readTablePackage(ARSCDecoder.java:133)
        at brut.androlib.res.decoder.ARSCDecoder.readTableHeader(ARSCDecoder.java:85)
        at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:51)
        ... 8 more```

wilco375 avatar Feb 22 '23 09:02 wilco375

@wilco375 same for messenger too.

kurtnettle avatar Feb 23 '23 20:02 kurtnettle

Marking other responses are off-topic as the original issue and Facebook, while they look the same are not. I replicate this, so adding "bug" label and backlogging.

Open for PRs or investigations for this. Thanks!

iBotPeaches avatar Mar 04 '23 19:03 iBotPeaches

Putting up a PR for this. The header chunk is lying about its reported size.

➜  2989 apktool d 2989.apk -f
I: Using Apktool 2.8.1-c744dd-SNAPSHOT on 2989.apk
I: Loading resource table...
W: Chunk header size (16), read (12). Exceeding bytes: 0x5353544B.
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/ibotpeaches/.local/share/apktool/framework/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I: Copying META-INF/services directory
➜  2989 

iBotPeaches avatar Jul 20 '23 11:07 iBotPeaches