Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

apktool error while decompiling .apk

Tags:

smali

apktool

I got this error while I was decompiling an .apk by apktool. Although It doesn't appear for all apk files. Also I had installed these three frameworks:

framework-res.apk
SystemUI.apk
twframework-res.apk

I tried two different versions of framework-res.apk but it didn't help. What should I do?

Thank you

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)
like image 699
ShayanKM Avatar asked Jun 06 '14 17:06

ShayanKM


1 Answers

First, please make sure you have upgraded your apktool to the latest version, you can follow the instruction here to install it.

Then you need to upgrade your framework file. When I tried to decompile some apk file, it will show error like this

Exception in thread "main" brut.androlib.err.UndefinedResObject: resource spec: 0x01010462

It is caused by your framework file didn't support the latest android version, I solved the problem by:

  1. delete the origin framwork file, mine is located in

I: Loading resource table from file: /Users/csc/Library/apktool/framework/1.apk

  1. Get a proper framework apk

    Take my phone(nexus 5, android 5.1) for exmaple, you can find the framework apk in /system/framework/, and it called framework-res.apk. Using adb pull to copy it on your computer, rename it to 1.apk, copy it to your framework file directory.

  2. Try again and problem solved.

    here is the detailed origin tutorial.

like image 165
SHICONG CAO Avatar answered Sep 28 '22 05:09

SHICONG CAO