lnln1111 / android-apktool

Automatically exported from code.google.com/p/android-apktool
Other
0 stars 0 forks source link

apktool 1.4.3 does not work with ICS v4.0.3 #291

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.apktool.bat -v d framework.jar framework
2.
3.

What is the expected output? What do you see instead?
1. A framework folder with disassembled smali code
2. D:\GalaxyS2\ROMs\XXLP1\Decomp>apktool.bat -v d framework.jar framework
Jan 16, 2012 10:06:22 AM brut.androlib.Androlib decodeSourcesSmali
INFO: Baksmaling...
Exception in thread "main" java.lang.RuntimeException: bad magic value: 64 65 78
 0a 30 33 36 00
        at org.jf.dexlib.DexFile.<init>(DexFile.java:377)
        at org.jf.dexlib.DexFile.<init>(DexFile.java:274)
        at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:44)
        at brut.androlib.src.SmaliDecoder.decode(SmaliDecoder.java:33)
        at brut.androlib.Androlib.decodeSourcesSmali(Androlib.java:68)
        at brut.androlib.ApkDecoder.decode(ApkDecoder.java:85)
        at brut.apktool.Main.cmdDecode(Main.java:128)
        at brut.apktool.Main.main(Main.java:65)

What version of the product are you using? On what operating system?
apktool v1.4.3
Windows 7 O/S

Please provide any additional information below.
This framework.jar is from ICS v4.0.3. Baksmali /smali was changed because the 
dex header version number changed. Same problem as apktool.jar.

Original issue reported on code.google.com by gcrut...@gmail.com on 16 Jan 2012 at 3:16

GoogleCodeExporter commented 9 years ago
If you change the MAGIC value of 53 to 54 in HeaderItem.java it should fix 
this. but only for v4.0.3 as it will not work for previous header versions. 
Just my 2 cents worth.

Original comment by gcrut...@gmail.com on 16 Jan 2012 at 12:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
At the bottom of the file HeaderItem.java is an array (MAGIC[]) of numbers.
These are the 1st 8 bytes of the dex header. All you have to do is change
the number 53 to 54 and recompile. Keep in mind that the resulting apktool
will ONLY work for v4.0.3 and not earlier versions.

To make it work for earlier versions you will have to modify the code at
the top of this file where is checks the header info. You will have to
check for both 53 and 54 in the header.

Gary

Original comment by gcrut...@gmail.com on 21 Jan 2012 at 3:35

GoogleCodeExporter commented 9 years ago
Could someone be so kind to do the recompile and put up a download link?

or do we have to wait for brut to do it?

thanks!

Original comment by KJ.Logem...@gmail.com on 21 Jan 2012 at 7:13

GoogleCodeExporter commented 9 years ago
OK...I "hacked" the apktool.jar file to handle the new header version since I 
could not       compile apktool due to mvn complaining about missing files. It 
seems to work okay with .jar files but not .apk files.

If anyone wants to try this, here is the link: http://goo.gl/A6Uem

Original comment by gcrut...@gmail.com on 22 Jan 2012 at 5:41

GoogleCodeExporter commented 9 years ago
NOTE: The above "hacked" apktool ONLY works with v4.0.3. 

Original comment by gcrut...@gmail.com on 22 Jan 2012 at 5:44

GoogleCodeExporter commented 9 years ago
New apktool 1.5.0 fixes this.

Original comment by connor.tumbleson on 17 Nov 2012 at 2:48