最近遇到一个很恶心的问题:
1 错误日志:
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:491) 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:50) at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:189) at brut.androlib.ApkDecoder.decode(ApkDecoder.java:114) at brut.apktool.Main.cmdDecode(Main.java:146) at brut.apktool.Main.main(Main.java:77) 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:44) at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:102) at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:83) at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
2 原本是以为是 apktool.jar 的问题?
后来子啊stackoverflow 上搜了一下,
SO THIS IS MY QUESTION : "What are the building requirements (on Eclypse) to permit an app to be decompiled by Apktool ?" I did some tests and couldn't find any rules... For example, i built an empty app (i just created it and exported it the project to an apk file), the building options were : Minimum : API 14, Android 4.0 Targeting : API 14, Android 4.0 Compile With : API 14, Android 4.0 And i couldn't decompiled the apk... Anyway, i can't decompiled ANY of my apps ! What do i have to change in the building options? I did my tests on Apktool 1.4.3 and 2.0.0 Also, proguard isn't activated. This link says that it could have problem for building versions upper than 21.1.1 but that it was fixed in ApkTool 2.0.0... https://code.google.com/p/android-apktool/issues/detail?id=680
然后我更新了apktool.jar 还是不可以,但是找到了问题,
原来是因为,我使用 adbmanager 更新的是后,更新的最新的版本, 5.1.1 API22原来,Eclispe 编译APK 的时候, 自动调用 build-tools/22.0.1 下面的jar包,可能采用了新的加密的方案,导致Apktool.jar 无法编译,
归根结底,就是Apktool.jar 没有更新的问题。
解决方案:
很简单,就是将22.0.1 删除,因为,android 以后最新的版本,只支持studio, 不再更新ADT 了。所以,建议以后发开的话,使用studio吧。!
参考网址:
时间: 2024-11-03 02:09:08