5,604,292 Members 49,122 Now Online
XDA Developers Android and Mobile Development Forum

[MODDING/THEMING] Apktool for ICS apks

Tip us?
 
xtremesv
Old
(Last edited by xtremesv; 22nd March 2012 at 08:47 PM.)
#1  
xtremesv's Avatar
Senior Member - OP
Thanks Meter 91
Posts: 103
Join Date: Dec 2010
Location: San Salvador
Default [MODDING/THEMING] Apktool for ICS apks

If you are an amateur/aficionado modder or themer, this is for you:

Some people are still having problems de/compiling system apks on Samsung ICS builds, most of the errors arising are related to "bad magic values". I googled a little and managed to find a modded Apktool. I’ve tested it and it has worked fine so far with many apks (e.g. framework-res, TouchWiz30Launcher, etc).

I packed all necessary files below, including new aapt from Android SDK 4.0.3. As you may already know, you need latest JDK for this to work.

*** NOTICE *** There are some apks like SystemUI that need special treatment. If errors are found when decompiling an apk with ICS Apktool, you have to try decompiling it using the Original Apktool which I've just uploaded, then for recompiling it you need to use the ICS Apktool (if you run the Original Apktool to recompile, you will probably encounter errors). Remember, both packages contain different aapt executables so it is recommended making two separate folders for each zip content.

Credit goes to Brut.all who developed the original Apktool and gcrut…@gmail.com who modded it.

NOTE: This thread is not intended to be a guide for modding or theming. If you want to start messing with apks, there are many tutorials out there.
Attached Files
File Type: zip ICS Apktool.zip - [Click for QR Code] (3.06 MB, 12512 views)
File Type: zip Original Apktool.zip - [Click for QR Code] (4.31 MB, 7106 views)
Samsung Galaxy S4 * WanamLite Rom
iPad Air WiFi
The Following 64 Users Say Thank You to xtremesv For This Useful Post: [ Click to Expand ]
 
i04055
Old
#2  
Senior Member
Thanks Meter 35
Posts: 352
Join Date: Jan 2011
this is not work for me... got error when trying to decompile SystemUI.apk:

Code:
Exception in thread "main" java.lang.RuntimeException: bad magic value: 64 65 78 0a 30 33 35 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)
any solution?
sileshnair Old
#3  
Guest
Thanks Meter
Posts: n/a
Quote:
Originally Posted by i04055 View Post
this is not work for me... got error when trying to decompile SystemUI.apk:

Code:
Exception in thread "main" java.lang.RuntimeException: bad magic value: 64 65 78 0a 30 33 35 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)
any solution?
Delete classes.dex from SystemUI.apk before decompiling. If you want to edit classes.dex use smali/baksmali 1.3.2.
 
xtremesv
Old
#4  
xtremesv's Avatar
Senior Member - OP
Thanks Meter 91
Posts: 103
Join Date: Dec 2010
Location: San Salvador
Quote:
Originally Posted by i04055 View Post
this is not work for me... got error when trying to decompile SystemUI.apk:

Code:
Exception in thread "main" java.lang.RuntimeException: bad magic value: 64 65 78 0a 30 33 35 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)
any solution?
Do the following:

Decompile SystemUI using "Original Apktool" (already uploaded to the OP). If you try to recompile the apk with the Original Apktool you might find errors so you have to recompile it but this time using the "ICS Apktool". I hope this work for you.
Samsung Galaxy S4 * WanamLite Rom
iPad Air WiFi
 
i04055
Old
(Last edited by i04055; 22nd March 2012 at 07:39 AM.)
#5  
Senior Member
Thanks Meter 35
Posts: 352
Join Date: Jan 2011
Quote:
Originally Posted by sileshnair View Post
Delete classes.dex from SystemUI.apk before decompiling. If you want to edit classes.dex use smali/baksmali 1.3.2.
I am succeed decompile it without classes.dex, searching for baksmali now...
-- edit ---

I've tried, but get the same error as below....

Quote:
Originally Posted by xtremesv View Post
Do the following:

Decompile SystemUI using "Original Apktool" (already uploaded to the OP). If you try to recompile the apk with the Original Apktool you might find errors so you have to recompile it but this time using the "ICS Apktool". I hope this work for you.
I am able to decompile it with original apk tool but when I tried to recompile it using ICS apktool i got this error :

Code:
E:\android\Lab\SystemUI\res\values\public.xml:318: error: Public symbol drawable/tw_stat_sys_6_level_signal_3 declared h
erbrut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\DOCUME~1\edp\LOCA
LS~1\Temp\APKTOOL4562847521524937175.tmp, -I, C:\Documents and Settings\edp\apktool\framework\1.apk, -S, E:\android\Lab\
SystemUI\res, -M, E:\android\Lab\SystemUI\AndroidManifest.xml]
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
        at brut.androlib.Androlib.buildResources(Androlib.java:248)
        at brut.androlib.Androlib.build(Androlib.java:171)
        at brut.androlib.Androlib.build(Androlib.java:154)
        at brut.apktool.Main.cmdBuild(Main.java:182)
        at brut.apktool.Main.main(Main.java:67)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\DOCUME~1\edp\LOCALS~1\Temp\APKTOOL4562847
521524937175.tmp, -I, C:\Documents and Settings\edp\apktool\framework\1.apk, -S, E:\android\Lab\SystemUI\res, -M, E:\and
roid\Lab\SystemUI\AndroidManifest.xml]
        at brut.util.OS.exec(OS.java:83)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
        ... 6 more
e is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:319: error: Public symbol drawable/tw_stat_sys_6_level_signal_3_fully decl
ared here is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:320: error: Public symbol drawable/tw_stat_sys_6_level_signal_4 declared h
ere is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:321: error: Public symbol drawable/tw_stat_sys_6_level_signal_4_fully decl
ared here is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:322: error: Public symbol drawable/tw_stat_sys_6_level_signal_5 declared h
ere is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:323: error: Public symbol drawable/tw_stat_sys_6_level_signal_5_fully decl
ared here is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:324: error: Public symbol drawable/tw_stat_sys_6_level_signal_6 declared h
ere is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:325: error: Public symbol drawable/tw_stat_sys_6_level_signal_6_fully decl
ared here is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:99: error: Public symbol drawable/tw_stat_sys_battery_not_charge declared
here is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:326: error: Public symbol drawable/tw_stat_sys_signal_null declared here i
s not defined.
E:\android\Lab\SystemUI\res\values\public.xml:327: error: Public symbol drawable/tw_status_bar_close_on declared here is
 not defined.
E:\android\Lab\SystemUI\res\values\public.xml:101: error: Public symbol drawable/zzz_stat_vt_signal declared here is not
 defined.
E:\android\Lab\SystemUI\res\values\public.xml:102: error: Public symbol drawable/zzz_stat_vt_signal_null declared here i
s not defined.
what's going wrong here?
 
xtremesv
Old
#6  
xtremesv's Avatar
Senior Member - OP
Thanks Meter 91
Posts: 103
Join Date: Dec 2010
Location: San Salvador
Quote:
Originally Posted by i04055 View Post
I've tried, but get the same error as below....

I am able to decompile it with original apk tool but when I tried to recompile it using ICS apktool i got this error :

Code:
E:\android\Lab\SystemUI\res\values\public.xml:318: error: Public symbol drawable/tw_stat_sys_6_level_signal_3 declared h
erbrut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\DOCUME~1\edp\LOCA
LS~1\Temp\APKTOOL4562847521524937175.tmp, -I, C:\Documents and Settings\edp\apktool\framework\1.apk, -S, E:\android\Lab\
SystemUI\res, -M, E:\android\Lab\SystemUI\AndroidManifest.xml]
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
        at brut.androlib.Androlib.buildResources(Androlib.java:248)
        at brut.androlib.Androlib.build(Androlib.java:171)
        at brut.androlib.Androlib.build(Androlib.java:154)
        at brut.apktool.Main.cmdBuild(Main.java:182)
        at brut.apktool.Main.main(Main.java:67)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\DOCUME~1\edp\LOCALS~1\Temp\APKTOOL4562847
521524937175.tmp, -I, C:\Documents and Settings\edp\apktool\framework\1.apk, -S, E:\android\Lab\SystemUI\res, -M, E:\and
roid\Lab\SystemUI\AndroidManifest.xml]
        at brut.util.OS.exec(OS.java:83)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
        ... 6 more
e is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:319: error: Public symbol drawable/tw_stat_sys_6_level_signal_3_fully decl
ared here is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:320: error: Public symbol drawable/tw_stat_sys_6_level_signal_4 declared h
ere is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:321: error: Public symbol drawable/tw_stat_sys_6_level_signal_4_fully decl
ared here is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:322: error: Public symbol drawable/tw_stat_sys_6_level_signal_5 declared h
ere is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:323: error: Public symbol drawable/tw_stat_sys_6_level_signal_5_fully decl
ared here is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:324: error: Public symbol drawable/tw_stat_sys_6_level_signal_6 declared h
ere is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:325: error: Public symbol drawable/tw_stat_sys_6_level_signal_6_fully decl
ared here is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:99: error: Public symbol drawable/tw_stat_sys_battery_not_charge declared
here is not defined.
E:\android\Lab\SystemUI\res\values\public.xml:326: error: Public symbol drawable/tw_stat_sys_signal_null declared here i
s not defined.
E:\android\Lab\SystemUI\res\values\public.xml:327: error: Public symbol drawable/tw_status_bar_close_on declared here is
 not defined.
E:\android\Lab\SystemUI\res\values\public.xml:101: error: Public symbol drawable/zzz_stat_vt_signal declared here is not
 defined.
E:\android\Lab\SystemUI\res\values\public.xml:102: error: Public symbol drawable/zzz_stat_vt_signal_null declared here i
s not defined.
what's going wrong here?
Take into account that both packages contents must be in separate folders to retain their respective aapt file which is different for each one. The best way to do this is to decompile SystemUI with Original Apktool then take the generated SystemUI folder and copy it into the ICS Apktool folder and recompile after your modding is done.
Samsung Galaxy S4 * WanamLite Rom
iPad Air WiFi
 
Vertumus
Old
#7  
Vertumus's Avatar
Recognized Themer
Thanks Meter 12797
Posts: 4,780
Join Date: Sep 2010
Location: Belgrade

 
DONATE TO ME
Nice thread mate. This will e of great help for new themers

Cheers
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
The Following User Says Thank You to Vertumus For This Useful Post: [ Click to Expand ]
 
i04055
Old
#8  
Senior Member
Thanks Meter 35
Posts: 352
Join Date: Jan 2011
Quote:
Originally Posted by xtremesv View Post
Take into account that both packages contents must be in separate folders to retain their respective aapt file which is different for each one. The best way to do this is to decompile SystemUI with Original Apktool then take the generated SystemUI folder and copy it into the ICS Apktool folder and recompile after your modding is done.
too bad... stil got same error... I'm really confused....
 
tonz22
Old
#9  
tonz22's Avatar
Senior Member
Thanks Meter 58
Posts: 305
Join Date: Dec 2006
Location: singapore
good job, helpful tool.

thank you.
sorry for my poor English.
---------------
SamSung Galaxy S2.
HTC HD2 @android
 
intronauta
Old
#10  
Senior Member
Thanks Meter 107
Posts: 277
Join Date: Aug 2009
I've solved my problems with apktool v1.4.3 and ICS-JPQ using the original aapt file of the last SDK/plattform-tools and not the aapt file provided by apktool. Now I can decompile/recompile whatever ICS file (at least for now).


Tested with framework-res.apk, SystemUI.apk, Settings.apk, Phone.apk and android.policy.jar

my2cents

The Following User Says Thank You to intronauta For This Useful Post: [ Click to Expand ]
Tags
apktool, decompile, galaxy s 2, ics, recompile
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes