Original issue 785 created by sh37092 on 2015-03-17T03:26:48.000Z:
What steps will reproduce the problem?
1.Decode mobileqq_android.apk
2.
3.
What is the expected output? What do you see instead?
I: Using Apktool 2.0.0-RC4 on mobileqq_android.apk
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Multiple res specs: attr/name
at brut.androlib.res.data.ResType.addResSpec(ResType.java:58)
at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:213)
at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:188)
at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:156)
at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:113)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:78)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:47)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:622)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:73)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:65)
at brut.androlib.Androlib.getResTable(Androlib.java:63)
at brut.androlib.ApkDecoder.setTargetSdkVersion(ApkDecoder.java:209)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:92)
at brut.apktool.Main.cmdDecode(Main.java:165)
at brut.apktool.Main.main(Main.java:81)
What version of the product are you using? On what operating system?
Apktool 2.0.0-RC4 on MacOSX with Java 1.8_40
Please provide any additional information below.
You can download mobileqq_android.apk from http://down.myapp.com/myapp/qqteam/AndroidQQ/mobileqq_android.apk
met same issue
@BobCromwell Do you have an apk to upload? The more apks of the similar issue I can get the better.
i have 2 apks like this, compressed them to this link - http://www.filedropper.com/multipleres
I'm using apktool v2.0.0 on Windows 7 with Java 1.8_40
Yes, both of those APKs exhibit the same problem.
Does this problem solved ?
How to debug apktool myself?
I have the same issue with this SystemUI.apk (frameworks are also included):
http://content.modaco.net/dropzone/h7systemuibug.zip
P
Having some trouble extracting this.
ibotpeaches@tombstone:~/Downloads/Apktool/Bug894$ unzip h7systemuibug.zip
Archive: h7systemuibug.zip
error [h7systemuibug.zip]: missing 266 bytes in zipfile
(attempting to process anyway)
error [h7systemuibug.zip]: attempt to seek before beginning of zipfile
(please check that you have transferred or created the zipfile in the
appropriate BINARY mode and that you have compiled UnZip properly)
(attempting to re-compensate)
inflating: framework-res.apk
error: invalid compressed data to inflate
file #2: bad zipfile offset (local header sig): 8641411
(attempting to re-compensate)
file #2: bad zipfile offset (local header sig): 8641411
file #3: bad zipfile offset (local header sig): 19368381
ibotpeaches@tombstone:~/Downloads/Apktool/Bug894$ md5sum h7systemuibug.zip
c36934e9203a48665bc4e8cb361028c3 h7systemuibug.zip
Not sure what happened there!
Reuploaded:
http://content.modaco.net/dropzone/h7systemuibug.2.zip
Thanks for your help. :) This is from the Honor 7 however (Huawei based), which could be the cause of the problem!
P
Yeah these apks have qualifiers that apktool does not know about.
opta# and optb#. Which causes all the strange errors, which isn't exactly the same as OP issue. Short of reverse engineering, I have no idea what these qualifiers serve, which makes it difficult to support, if at all. I believe this then is the same problem as in #836
here the same problem
LBE Security Master - Beta_6.1.2197.apk
The reason for "Exception in thread "main" brut.androlib.AndrolibException: Multiple res specs:
attr/0" is: res directory name and file name is proguarded. reference to http://bbs.pediy.com/showthread.php?p=1308494
Started researching this. Most resources have the same key as shown
spec resource 0x7f010000 com.tencent.mobileqq:attr/name: flags=0x00000000
spec resource 0x7f010001 com.tencent.mobileqq:attr/name: flags=0x00000000
spec resource 0x7f010002 com.tencent.mobileqq:attr/name: flags=0x00000000
spec resource 0x7f010003 com.tencent.mobileqq:attr/name: flags=0x00000000
spec resource 0x7f010004 com.tencent.mobileqq:attr/name: flags=0x00000000
spec resource 0x7f010005 com.tencent.mobileqq:attr/name: flags=0x00000000
spec resource 0x7f010006 com.tencent.mobileqq:attr/name: flags=0x00000000
spec resource 0x7f010007 com.tencent.mobileqq:attr/name: flags=0x00000000
spec resource 0x7f010008 com.tencent.mobileqq:attr/name: flags=0x00000000
spec resource 0x7f010009 com.tencent.mobileqq:attr/name: flags=0x00000000
spec resource 0x7f01000a com.tencent.mobileqq:attr/name: flags=0x00000000
Apktool stores based on type/key_name. This should be unique, but this proves otherwise. Hence the "double resource" errors. Anything on device goes by resourceId, so this doesn't cause a problem.
For apktool however, it does. I did a quick n dirty patch with Dexguard by just creating unique key names (https://github.com/iBotPeaches/Apktool/commit/f9323943db1776aad4d06862011ea2aea2416bfc). Since the only place the human readable key name is used is resources, we know the dummy value name from the resourceId, so this doesn't break anything.
The correct fix may be as follows.
key_name is null or empty, then replace with a dummy value that is unique. IE (APKTOOL_DUMMYVAL_{HEXID}).key_name is not empty, but a duplicate occurs. Append a number onto the end (Probably resourceId) to prevent having to keep track of a counter.resourceIds which haven't changed so built apk should have the same functionality as original. Granted the decode application will look different, but the real key names have been destroyed/obfuscated/removed/something by Dexguard and other Obfuscation apps so we can't really ever use them.key_names in human readable form.I build apktool from master branch. It should include the f9323943db1776aad4d06862011ea2aea2416bfc commit. But it still failed with com.tencent.mobileqq.
I: Using Apktool 2.0.3-13b399-SNAPSHOT on mobileqq_android.apk
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Multiple res specs: attr/name
at brut.androlib.res.data.ResTypeSpec.addResSpec(ResTypeSpec.java:78)
at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:248)
at brut.androlib.res.decoder.ARSCDecoder.readTableType(ARSCDecoder.java:212)
at brut.androlib.res.decoder.ARSCDecoder.readTableTypeSpec(ARSCDecoder.java:154)
at brut.androlib.res.decoder.ARSCDecoder.readTablePackage(ARSCDecoder.java:116)
at brut.androlib.res.decoder.ARSCDecoder.readTableHeader(ARSCDecoder.java:78)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:47)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:544)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:63)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:55)
at brut.androlib.Androlib.getResTable(Androlib.java:66)
at brut.androlib.ApkDecoder.setTargetSdkVersion(ApkDecoder.java:198)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:96)
at brut.apktool.Main.cmdDecode(Main.java:165)
at brut.apktool.Main.main(Main.java:81)
It shouldn't work with that commit. com.tencent.mobileqq has multiple names of the same word. The fix was for resources that had no name (ie empty).
A fix to detect current resources and detect duplicates and avoid them by adding uniqueness needs to be added.
Thanks. I see. I misunderstood your words.
See this Chinese blog please, http://www.mak-blog.com/tencent-shell-crack.html
Thanks @donly
Looks like 3 separate issues at hand here. I'll try and get the dex files to the smali project to confirm if those patches will work for that issue. Then I already have a duplicate resource patch underway.
These fixes won't make the 2.0.3 release today, but should make 2.1.0.
@iBotPeaches
When approximately wait 2.1.0 with fix?
Well the fix hasn't happened yet, so no idea. My releases tend to be 2-3 months apart and I just released 2.0.3 on 12/31/2015 so probably in late February or early March.
how to fix this problem now?
@iBotPeaches Giving you another ping on this one. :)
Sorry for delay on this issue. I've spent the past few days really working on it, and I can't seem to get rebuilding working yet, but decoding works. I'll get that pushed out here shortly.
➜ Bug894 apktool d mobileqq_android.apk -f
I: Using Apktool 2.2.0-e1dd43-SNAPSHOT on mobileqq_android.apk
I: Loading resource table...
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: Baksmaling classes2.dex...
I: Baksmaling classes3.dex...
I: Baksmaling classes4.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I've decided due to impending release of Android Nougat and the possibility that aapt2 (The 2nd iteration of aapt) will be out and thus changing the entire build side of apktool, I shouldn't spend too much time patching build support into a soon to be deprecated aapt binary.
Most helpful comment
@iBotPeaches Giving you another ping on this one. :)