Post Reply

[HOW TO] Compile/Decompile ICS Apk easily|100% working

OP memnoc

22nd February 2012, 09:50 PM   |  #1  
memnoc's Avatar
OP Recognized Developer
Thanks Meter: 5,226
 
4,456 posts
Join Date:Joined: Feb 2011
Donate to Me
We are all here to learn, take from community and give back to community!!!
@Lord ClockaN

Hya guys, after A LOT of requests, I decided to share with the community something that I found really REALLY useful for Dev's but also for other users too that want to mess up with compiling and decompiling process. Usually, non problems at all with that, but since ICS come out, many dev\users are not able to decompile\compile properly many ics apk (not all). This guide will ensure you a good result, 100% working, easy, and fastest way to mess up with ics for theming and resizing purposes, or whatever you want
BIG THX to my friend and Dev teammate @Bichon for this

Credits
@Bichon (yes, again)
@Xavierjohn22, the amazing author of AutoApktool! Visit his thread HERE, click his thanks button, and support his work with donations, and my personal thanks to author for this tool which is the most powerful and easiest tool ever.
@Brut_all for Apktool
@XDA Community
@Google

About Apktooll

Please consider to visit the original thread about this tool, because what I'm explaining here is just 1\10 of the real skill of this tool. You can do basically whatever you want with AutoApktool, themers will love it, Dev's will appreciate it a lot, I'm sure.

Why can't we use Apktool???

Well, you can, but it's more difficult, that's it.

Why do you say "must use 1.4.1 apktool version"??

The reason why is that since 1.4.2 version, apktool generate java code while recompiling process is going on, and this lead to errors that 9/10 makes decompile process fail.

Requirements (Windows environment, mine is Seven 64 bit)

Java (last version)
JDK (last version)
JDR (last version, usually included in JDK or Java)
SDK (last 3.0 version for ICS source code)
Auto_Apktool 2.0.0 (DOWNLOAD THIS ONE NOT OTHERS!!!)

HOW-TO (NOTE: before start, select Apktool version with option 21, YOU MUST CHOOSE 1.4.1 version!!)

1) Download and simply unpack Auto_ApkTool 2.0.0
2)Click on "autoapktoolmain.bat", prompt will open

3)put the apk you want to mess up with in "_INPUT_APK"

4) you can chose more than one option to decompile (option 6 is strongly recommended)
5) when option 6 is being selected, drag the apk from _INPUT_APK folder into the windows prompt and click enter

6) A Note window will appear, and will show IF the decompiling process has been done properly. Once you close that window, you will see the decompiled folder in _INPUT_APK folder

7) do your edits (xml, snali, or png, doesn't matter)
8) recompile with option 7 (NOTE: this time you MUST drag all the FOLDER, NOT the apk)
9) Once recompiling finished, open the decompiled folder, go to "dist" folder, and here you got your edited apk

10) you MUST sign the apk with option 10 (NOTE: drag the apk from dist folder to the prompt, then press enter, and in the SAME folder, a signedxxx.apk will appear)

11) Rename the apk, and push it |NOTE: you can push the apk with 62 option or with sdk typing:
Code:
adb remount
adb push xxx.apk system/app
adb reboot
That's it
Last edited by memnoc; 23rd February 2012 at 11:47 AM.
The Following 75 Users Say Thank You to memnoc For This Useful Post: [ View ]
22nd February 2012, 09:50 PM   |  #2  
memnoc's Avatar
OP Recognized Developer
Thanks Meter: 5,226
 
4,456 posts
Join Date:Joined: Feb 2011
Donate to Me
NOTE FOR SAMSUNG USERS

Samsung changed some Hex value in the compiled dex code.
It has nothing to do with resources apks or anthing.
If you want to decompile those apks you have to do the follwing:

Using 7zip extract the classes.dex file from the apk and save it somewhere.\
Delete the classes.dex file from the apk.
Now you can decompile the apk using this tutorial.
If you want to decompile the classes.dex to edit the smali code, download baksmali 1.3.2 and smali 1.3.2 and use them to decompile and recompile the classes.dex.
After you recompiled the edited smali code, just drag back in the new classes.dex file you made.

this won't be fixed until Brut will make a new Apktool, or someone inserted the new baksmali/smali code into apktool

THX @Firefeds

When you're in trouble...try this one, you can apply the following method to the op too
Downloads:
http://code.google.com/p/smali/downloads/list
smali/baksmali editing v1.3.2

- Download both smali and baksmali v1.3.2

http://code.google.com/p/android-apktool/downloads/list
This is the latest apktool used to compile/decompile .apk.
Download apktool1.4.3.tar.bz2 and apktool-install-windows-r04-brut1.tar.bz2 for Windows or
apktool-install-macosx-r04-brut1.tar.bz2 and apktool-install-linux-r04-brut1.tar.bz2 for Mac. Follow the instruction on installation.

Step by step:
1. Extract the classes.dex from the desired apk.
2. Decompile it with baksmali v1.3.2 (for modding smali)
3. Recompile classes.dex with smali v1.3.2.
4. Decompile the apk with apktool (without classes.dex in the apk itself).
4a. Modify the apk however you want to, adding your changes.
4b. Recompile it with apktool.
5. Put the modified apk back into classes.dex.
6. Sign the apk.


thx @djolebih
Last edited by memnoc; 24th March 2012 at 05:52 PM.
The Following 20 Users Say Thank You to memnoc For This Useful Post: [ View ]
22nd February 2012, 09:55 PM   |  #3  
Headbanger1982's Avatar
Senior Member
Flag Bologna
Thanks Meter: 47
 
167 posts
Join Date:Joined: Oct 2011
More
You're the boss man ^_^

Great work.
22nd February 2012, 10:22 PM   |  #4  
zFr3eak's Avatar
Recognized Developer
Flag Salzburg
Thanks Meter: 4,904
 
3,472 posts
Join Date:Joined: Mar 2010
Donate to Me
More
great tutorial
The Following 2 Users Say Thank You to zFr3eak For This Useful Post: [ View ]
22nd February 2012, 10:25 PM   |  #5  
memnoc's Avatar
OP Recognized Developer
Thanks Meter: 5,226
 
4,456 posts
Join Date:Joined: Feb 2011
Donate to Me
Quote:
Originally Posted by zFr3eak

great tutorial

Thx my friend, I have a great team behind the scene
The Following 3 Users Say Thank You to memnoc For This Useful Post: [ View ]
22nd February 2012, 11:02 PM   |  #6  
mattkle's Avatar
Senior Member
Flag Melbourne
Thanks Meter: 279
 
427 posts
Join Date:Joined: Jan 2010
Donate to Me
More
Talking
Awesome bro!


I shall include your insight on the official Smartdroid website too.


Keep it up your contribution to the DHD community is invaluable.

The Following User Says Thank You to mattkle For This Useful Post: [ View ]
22nd February 2012, 11:05 PM   |  #7  
memnoc's Avatar
OP Recognized Developer
Thanks Meter: 5,226
 
4,456 posts
Join Date:Joined: Feb 2011
Donate to Me
Quote:
Originally Posted by mattkle

Awesome bro!


I shall include your insight on the official Smartdroid website too.


Keep it up your contribution to the DHD community is invaluable.

thx bro, hope people find it useful, you too
The Following 2 Users Say Thank You to memnoc For This Useful Post: [ View ]
22nd February 2012, 11:54 PM   |  #8  
OrcoX1iSE's Avatar
Member
Flag Crema
Thanks Meter: 27
 
84 posts
Join Date:Joined: Feb 2009
More
Thumbs up
Well done Mem!! This will be so much usefull when ICS Sense ROM will arrive for DHD!!
22nd February 2012, 11:58 PM   |  #9  
memnoc's Avatar
OP Recognized Developer
Thanks Meter: 5,226
 
4,456 posts
Join Date:Joined: Feb 2011
Donate to Me
Quote:
Originally Posted by OrcoX1iSE

Well done Mem!! This will be so much usefull when ICS Sense ROM will arrive for DHD!!

Ics Sense rom is already available for dhd LOL
Thx anyway

Inviato dal mio HTC Desire HD with Beats Audio usando Tapatalk
The Following 2 Users Say Thank You to memnoc For This Useful Post: [ View ]
23rd February 2012, 08:59 AM   |  #10  
Vertumus's Avatar
Recognized Themer
Flag Belgrade
Thanks Meter: 12,815
 
4,774 posts
Join Date:Joined: Sep 2010
Donate to Me
More
Great tutorial mate. As soon as I come home ill try. I am moving my theme to the ICS and I hope this works with samsung ics apps

All the best,
Vert

---------- Post added at 09:59 AM ---------- Previous post was at 09:43 AM ----------

It doesn't work with bloody samsung ics apps...
[*] C:\Users\040588\Desktop\AutoAPKTool2.0.0\_INPUT_AP K\SystemUI.apk
decompiling C:\Users\040588\Desktop\AutoAPKTool2.0.0\_INPUT_AP K\SystemUI.apk...
I: 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)

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Desire HD Android Development by ThreadRank