Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,729,266 Members 41,774 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
memnoc
Old
(Last edited by memnoc; 23rd February 2012 at 11:47 AM.)
#1  
memnoc's Avatar
Recognized Developer - OP
Thanks Meter 4843
Posts: 4,198
Join Date: Feb 2011

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

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

The Following 75 Users Say Thank You to memnoc For This Useful Post: [ Click to Expand ]
 
memnoc
Old
(Last edited by memnoc; 24th March 2012 at 05:52 PM.)
#2  
memnoc's Avatar
Recognized Developer - OP
Thanks Meter 4843
Posts: 4,198
Join Date: 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

The Following 20 Users Say Thank You to memnoc For This Useful Post: [ Click to Expand ]
 
Headbanger1982
Old
#3  
Headbanger1982's Avatar
Senior Member
Thanks Meter 47
Posts: 167
Join Date: Oct 2011
Location: Bologna
You're the boss man ^_^

Great work.
Forever #58 & #46 - Ciao Marco

Live to Thrash - Thrash to Live

- Samsung Galaxy Nexus - Maguro

HTC Sensation - Sold
Galaxy S2 i9100 - Sold
Galaxy S i9000 - Sold
SE Xperia X10 Mini - Sold
iPhone 3Gs 32Gb - Sold
 
zFr3eak
Old
#4  
zFr3eak's Avatar
Recognized Developer
Thanks Meter 4903
Posts: 3,471
Join Date: Mar 2010
Location: Salzburg

 
DONATE TO ME
great tutorial

aCalculator - Calculator



The Following 2 Users Say Thank You to zFr3eak For This Useful Post: [ Click to Expand ]
 
memnoc
Old
#5  
memnoc's Avatar
Recognized Developer - OP
Thanks Meter 4843
Posts: 4,198
Join Date: Feb 2011

 
DONATE TO ME
Quote:
Originally Posted by zFr3eak View Post
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: [ Click to Expand ]
 
mattkle
Old
#6  
mattkle's Avatar
Senior Member
Thanks Meter 279
Posts: 427
Join Date: Jan 2010
Location: Melbourne

 
DONATE TO ME
Awesome bro!


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


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

DamageControl
[/B][/SIZE]

on my new sexy HTC One
The Following User Says Thank You to mattkle For This Useful Post: [ Click to Expand ]
 
memnoc
Old
#7  
memnoc's Avatar
Recognized Developer - OP
Thanks Meter 4843
Posts: 4,198
Join Date: Feb 2011

 
DONATE TO ME
Quote:
Originally Posted by mattkle View Post
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: [ Click to Expand ]
 
OrcoX1iSE
Old
#8  
OrcoX1iSE's Avatar
Member
Thanks Meter 27
Posts: 84
Join Date: Feb 2009
Location: Crema
Well done Mem!! This will be so much usefull when ICS Sense ROM will arrive for DHD!!
HTC Desire HD Rooted & ENG S-OFF
ROM: Virtuous Affinity 2.05.0 GB 2.3.5 & Sense 3.5
MODs: WiP
RADIO: 26.09.04.11_M2
KERNEL: MDj V10
RECOVERY: 4EXTRecovery Touch 1.0.0.3 RC3

SE Experia X8 Unchained
ROM: GingerDX v021 (CM7 Based - GB 2.3.7)
MODs: CM7
RADIO: Stock
KERNEL: Stock
RECOVERY: xRecovery + CWM 3.2

My MODS: ShrekMod CarbonLook (for VirtuousUnity 2.3x.0)
 
memnoc
Old
#9  
memnoc's Avatar
Recognized Developer - OP
Thanks Meter 4843
Posts: 4,198
Join Date: Feb 2011

 
DONATE TO ME
Quote:
Originally Posted by OrcoX1iSE View Post
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: [ Click to Expand ]
 
Vertumus
Old
#10  
Vertumus's Avatar
Recognized Themer
Thanks Meter 12812
Posts: 4,774
Join Date: Sep 2010
Location: Belgrade

 
DONATE TO ME
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)
My official web-site: Vertumus World
My work: Domination
Follow the updates: GOOGLE +TWITTER FACEBOOK

Check out my widgets and icons on Google Play!!!

If you like my work, please consider a DONATION

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes