反编译.apk时出现apktool错误
Posted
技术标签:
【中文标题】反编译.apk时出现apktool错误【英文标题】:apktool error while decompiling .apk 【发布时间】:2014-07-28 01:52:31 【问题描述】:我在使用 apktool 反编译 .apk 时遇到此错误。虽然它不会出现在所有 apk 文件中。 我也安装了这三个框架:
framework-res.apk
SystemUI.apk
twframework-res.apk
我尝试了两种不同版本的 framework-res.apk,但没有帮助。 我该怎么办?
谢谢
I: Baksmaling...
Error occured while disassembling class Ldxoptimizer.con; - skipping class
java.io.IOException: The parameter is incorrect
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:883)
at org.jf.baksmali.baksmali.disassembleDexFile(baksmali.java:176)
at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:49)
at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:34)
at brut.androlib.Androlib.decodeSourcesSmali(Androlib.java:74)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:89)
at brut.apktool.Main.cmdDecode(Main.java:146)
at brut.apktool.Main.main(Main.java:77)
I: Loading resource table...
I: Loaded.
I: Decoding androidManifest.xml with resources...
I: Loading resource table from file: C:\Users\ShayanK\apktool\framework\1.apk
I: Loaded.
W: Could not decode attr value, using undecoded value instead: ns=android, name=
hardwareAccelerated, value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=android, name=
hardwareAccelerated, value=0xffffffff
W: Could not decode attr value, using undecoded value instead: ns=android, name=
hardwareAccelerated, value=0xffffffff
I: Regular manifest package...
I: Decoding file-resources...
W: Could not decode attr value, using undecoded value instead: ns=android, name=
exitFadeDuration, value=0x00000190
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3f333333
W: Could not decode attr value, using undecoded value instead: ns=android, name=
previewImage, value=0x7f020001
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x00000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3f000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3f000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3e99999a
W: Could not decode attr value, using undecoded value instead: ns=android, name=
previewImage, value=0x7f020002
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3f000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x3f000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
showAsAction, value=0x00000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
alpha, value=0x00000000
W: Could not decode attr value, using undecoded value instead: ns=android, name=
previewImage, value=0x7f020002
W: Could not decode attr value, using undecoded value instead: ns=android, name=
previewImage, value=0x7f020001
I: Decoding values */* XMLs...
Exception in thread "main" brut.androlib.err.UndefinedResObject: resource spec:
0x01030119
at brut.androlib.res.data.ResPackage.getResSpec(ResPackage.java:61)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:58)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:54)
at brut.androlib.res.data.value.ResReferenceValue.getReferent(ResReferen
ceValue.java:62)
at brut.androlib.res.data.value.ResReferenceValue.encodeAsResXml(ResRefe
renceValue.java:46)
at brut.androlib.res.data.value.ResScalarValue.encodeAsResXmlAttr(ResSca
larValue.java:44)
at brut.androlib.res.data.value.ResStyleValue.serializeToResValuesXml(Re
sStyleValue.java:48)
at brut.androlib.res.data.value.ResBagValue.serializeToResValuesXml(ResB
agValue.java:40)
at brut.androlib.res.AndrolibResources.generateValuesFile(AndrolibResour
ces.java:440)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:243
)
at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:115)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:114)
at brut.apktool.Main.cmdDecode(Main.java:146)
at brut.apktool.Main.main(Main.java:77)
【问题讨论】:
【参考方案1】:首先,请确保您的apktool已经升级到最新版本,您可以按照here的说明进行安装。
然后你需要升级你的框架文件。当我试图反编译一些apk文件时,它会显示这样的错误
线程“主”brut.androlib.err.UndefinedResObject 中的异常: 资源规格:0x01010462
这是因为你的框架文件不支持最新的android版本,我解决了这个问题:
-
删除源框架文件,我的位于
I:从文件加载资源表:/Users/csc/Library/apktool/framework/1.apk
获取合适的框架apk
以我的手机(nexus 5,android 5.1)为例,你可以在 /system/framework/ 中找到框架 apk,它名为 framework-res.apk。使用adb pull复制到你的电脑上,重命名为1.apk,复制到你的framework文件目录下。
再试一次,问题就解决了。
here是详细的起源教程。
【讨论】:
以上是关于反编译.apk时出现apktool错误的主要内容,如果未能解决你的问题,请参考以下文章