安卓逆向:apktool 反编译时报错 Exception in thread "main" brut.androlib.AndrolibException: Could not decode ...

1. 环境

  • windows 10;
  • apktool 2.0.0;

2. 问题

使用 apktool 工具反编译 apk 文件时报 Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file 错误,如下:

I: Using Apktool 2.0.0-Beta9 on keep.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:54)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:604)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:74)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:66)
at brut.androlib.Androlib.getResTable(Androlib.java:49)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:93)
at brut.apktool.Main.cmdDecode(Main.java:169)
at brut.apktool.Main.main(Main.java:85)
Caused by: java.io.IOException: Expected: 0x001c0001, got: 0x00000000
at brut.util.ExtDataInput.skipCheckInt(ExtDataInput.java:48)
at brut.androlib.res.decoder.StringBlock.read(StringBlock.java:43)
at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:95)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:81)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
... 7 more

3. 解决

  • 上面的问题是由于 apktool.jar 版本过低导致的,更新 apktool.jar 为最新版即可解决;
  • 下载地址:https://ibotpeaches.github.io/Apktool/;
  • 下载后的 jar 文件重命名为 apktool.jar,并复制到 apktool 文件夹替换原有 jar 文件,重新编译即可解决问题,如下图:
image.png

你可能感兴趣的:(安卓逆向:apktool 反编译时报错 Exception in thread "main" brut.androlib.AndrolibException: Could not decode ...)