[TUTORIAL] How to Decompile and Recompile ICS .Apk Files][Easy ONE]

cuvix

Senior Member
Feb 15, 2012
68
23
0
Selong
Even just replacing the single icon won't let us to install the apk normally (if we have the "true official untouched" system core including phonesky/market) if we don't "really sign it". I believe this because I've met the same case as AryanAkanskh. Except we push the "modified" apk without signing MAY will work.

The META-INF or "APK SIGN" contain hash code (md5 or whatever they called it) for every single file inside the apk. I assume the "sign" is the first security check in android system when we want to install (let's say copy-paste from the original source to "userdata/app" partition) any apk. That's why when we "manually install" it (push to userdata or system) will work even without signing, as long as the AndroidManifest.xml wasn't modified. :confused:

But, that's all my opinion, just assuming. So, please correct me if any of my statement is wrong. :highfive:
 

SXUsr

Senior Member
Jul 11, 2010
8,144
2,867
243
Here =)
Thank for sharing this "Aryan", if any one else got good tutorials, plz care to share, My thread is Open For everyone, if the Method is Useful I will pin it to OP, so that u guys will have multiple choices and follow the 1 which work for you :thumbup::):cool:
:good: See the second link in my sig, while programs are good I still prefer the manual method which I've tried to explain in detail more than how to use a specific program. :)

---------- Post added at 07:14 PM ---------- Previous post was at 07:07 PM ----------

But, that's all my opinion, just assuming. So, please correct me if any of my statement is wrong. :highfive:
If all you want to do is replace a specific image then you don't need to decompile, all you need to do is drag and drop the new images into the apk, zipalign and push it back so you don't need to worry about signatures or signing anything.
 

cuvix

Senior Member
Feb 15, 2012
68
23
0
Selong
If all you want to do is replace a specific image then you don't need to decompile, all you need to do is drag and drop the new images into the apk, zipalign and push it back so you don't need to worry about signatures or signing anything.
Yes, exactly if it is about push back.
What the point I state to is the installable modified apk, not the push-able. ;)
 

AryanAkanskh

Senior Member
Apr 26, 2012
130
80
0
Singapore
Yes, exactly if it is about push back.
What the point I state to is the installable modified apk, not the push-able. ;)
Yes agree with you. . even I tried to create an installable apk. . And the method I postd just workd fine. .

I assume thats coz of apktool. There will be a step lyk
'Apktool if apkname.apk' which gets an 'idea' abt the framework of the said file.
So the next recompile command uses the framework data which we pulled before and then recompiles the modified apk. Signing the apk cmpletes the process.

Pl correct me if am wrong.

Sent from my ST15i using xda app-developers app
 
Last edited:

R10MaRiOo

Senior Member
Feb 12, 2012
82
7
0
Mexico!!
[*] C:\Users\Mario\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res
recompiling C:\Users\Mario\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res...
W: Could not find sources
I: Building resources...
C:\Users\Mario\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res\res\values\public.xml:4794: error: Public resource string/permlab_external_lockscreen has conflicting type codes for its public identifiers (0x4 vs 0xf).
C:\Users\Mario\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res\res\values\public.xml:4795: error: Public resource string/permdesc_external_lockscreen has conflicting type codes for its public identifiers (0x4 vs 0xf).
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\Users\Mario\AppData\Local\Temp\APKTOOL4496791571819417214.tmp, -x, -S, C:\Users\Mario\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res\res, -M, C:\Users\Mario\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res\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:\Users\Mario\AppData\Local\Temp\APKTOOL4496791571819417214.tmp, -x, -S, C:\Users\Mario\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res\res, -M, C:\Users\Mario\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:83)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
... 6 more
I got this error when compile framework-res
Please help me
 
Last edited:

Abhinav1997

Inactive Recognized Developer / Retired Forum Mode
Jul 29, 2012
2,590
5,305
0
When I try to decompile apex launcher i got the multiple resources error(yes i have all the requirements)...
Here's the complete log:
Code:
[*] C:\Users\Mohan\Downloads\AutoAPKTool2.0.4a\AutoAPKTool2.0.4\_INPUT_APK\Apex_Launcher_1_4_3.apk 
decompiling C:\Users\Mohan\Downloads\AutoAPKTool2.0.4a\AutoAPKTool2.0.4\_INPUT_APK\Apex_Launcher_1_4_3.apk... 
I: Baksmaling...
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Multiple resources: spec=0x7f020002 drawable/apex_launcher_pro_ribbon, config=-xhdpi
	at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:65)
	at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:58)
	at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:196)
	at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:165)
	at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:130)
	at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:105)
	at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:82)
	at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
	at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:315)
	at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:50)
	at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:43)
	at brut.androlib.Androlib.getResTable(Androlib.java:44)
	at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:148)
	at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
	at brut.apktool.Main.cmdDecode(Main.java:128)
	at brut.apktool.Main.main(Main.java:65)
EDIT: But when i try to decompile some other apk for e.g. whatsapp it's done correctly....here's the log of decompiling whatsapp...
Code:
[*] C:\Users\Mohan\Downloads\AutoAPKTool2.0.4a\AutoAPKTool2.0.4\_INPUT_APK\Whatsapp.apk 
decompiling C:\Users\Mohan\Downloads\AutoAPKTool2.0.4a\AutoAPKTool2.0.4\_INPUT_APK\Whatsapp.apk... 
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\Mohan\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
So no errors in this...
Please help me decompiling apex....

Best Regards,
AJ
 
Last edited:

sandy7

Inactive Recognized Developer
May 28, 2012
6,215
6,842
0
31
bangalore
When I try to decompile apex launcher i got the multiple resources error(yes i have all the requirements)...
Here's the complete log:
Code:
[*] C:\Users\Mohan\Downloads\AutoAPKTool2.0.4a\AutoAPKTool2.0.4\_INPUT_APK\Apex_Launcher_1_4_3.apk 
decompiling C:\Users\Mohan\Downloads\AutoAPKTool2.0.4a\AutoAPKTool2.0.4\_INPUT_APK\Apex_Launcher_1_4_3.apk... 
I: Baksmaling...
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Multiple resources: spec=0x7f020002 drawable/apex_launcher_pro_ribbon, config=-xhdpi
	at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:65)
	at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:58)
	at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:196)
	at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:165)
	at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:130)
	at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:105)
	at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:82)
	at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
	at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:315)
	at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:50)
	at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:43)
	at brut.androlib.Androlib.getResTable(Androlib.java:44)
	at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:148)
	at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
	at brut.apktool.Main.cmdDecode(Main.java:128)
	at brut.apktool.Main.main(Main.java:65)
EDIT: But when i try to decompile some other apk for e.g. whatsapp it's done correctly....here's the log of decompiling whatsapp...
Code:
[*] C:\Users\Mohan\Downloads\AutoAPKTool2.0.4a\AutoAPKTool2.0.4\_INPUT_APK\Whatsapp.apk 
decompiling C:\Users\Mohan\Downloads\AutoAPKTool2.0.4a\AutoAPKTool2.0.4\_INPUT_APK\Whatsapp.apk... 
I: Baksmaling...
I: Loading resource table...
I: Loaded.
I: Loading resource table from file: C:\Users\Mohan\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
So no errors in this...
Please help me decompiling apex....

Best Regards,
AJ
dont use this tool for system apps.....use this tool only for frameworks...

for system apps and other apps use Apktool bu 'iboltpeaches'
 
  • Like
Reactions: Abhinav1997

Abhinav1997

Inactive Recognized Developer / Retired Forum Mode
Jul 29, 2012
2,590
5,305
0
Ok so I tried to decompile whatsapp and change some of it's icons(only 3 about-logo, logo and icon) with gimp(2) and then saved the icons with default gimp settings and now when I recompiled it it went fine but now when I install it it says app not installed...also I saw another modded whatsapp which had meta-inf and com folder and these were missing from mine so I moved it using 7 zip but still same error....
Sorry for my question i'm new to these things,,,,
Thanks in Advanced :D

Best Regards,
AJ
 
  • Like
Reactions: abdul1987

stanlin salu

Senior Member
Apr 12, 2012
1,849
2,220
0
New Delhi
Ok so I tried to decompile whatsapp and change some of it's icons(only 3 about-logo, logo and icon) with gimp(2) and then saved the icons with default gimp settings and now when I recompiled it it went fine but now when I install it it says app not installed...also I saw another modded whatsapp which had meta-inf and com folder and these were missing from mine so I moved it using 7 zip but still same error....
Sorry for my question i'm new to these things,,,,
Thanks in Advanced :D

Best Regards,
AJ
For replacing pngs no need to decompile just, open the apk with winrar or 7zip and replace it with whatever u want !
 
  • Like
Reactions: Abhinav1997

Abhinav1997

Inactive Recognized Developer / Retired Forum Mode
Jul 29, 2012
2,590
5,305
0
For replacing pngs no need to decompile just, open the apk with winrar or 7zip and replace it with whatever u want !
Ok I copies those pngs on desktop of my pc, changed them and saved(with gimp default settings) them and dragged to the apk opened in 7zip and then closed the zip and installed but still it wasn't installing...please help me!!
Thanx in advance :D

Best Regards,
AJ
 

sandy7

Inactive Recognized Developer
May 28, 2012
6,215
6,842
0
31
bangalore
Ok I copies those pngs on desktop of my pc, changed them and saved(with gimp default settings) them and dragged to the apk opened in 7zip and then closed the zip and installed but still it wasn't installing...please help me!!
Thanx in advance :D

Best Regards,
AJ
use winrar....place the png's in proper folder and then push it
 
  • Like
Reactions: Abhinav1997

stanlin salu

Senior Member
Apr 12, 2012
1,849
2,220
0
New Delhi
Ok I copies those pngs on desktop of my pc, changed them and saved(with gimp default settings) them and dragged to the apk opened in 7zip and then closed the zip and installed but still it wasn't installing...please help me!!
Thanx in advance :D

Best Regards,
AJ
Bro, do this on the original whatsapp's .apk file, not on the one which u decompiled and recompiled !
 
  • Like
Reactions: Abhinav1997

Abhinav1997

Inactive Recognized Developer / Retired Forum Mode
Jul 29, 2012
2,590
5,305
0
Bro, do this on the original whatsapp's .apk file, not on the one which u decompiled and recompiled !
Yep I know I'm doing it in original file only... :(

Press THANKS if I helped,
Best Regards,
AJ

---------- Post added at 05:32 PM ---------- Previous post was at 05:30 PM ----------

use winrar....place the png's in proper folder and then push it
ok I'll use winrar and im just dragging my modded whatsapp PNG to the res/drawables-hdpi/ folder....

Press THANKS if I helped,
Best Regards,
AJ
 

stanlin salu

Senior Member
Apr 12, 2012
1,849
2,220
0
New Delhi
Yep I know I'm doing it in original file only... :(

Press THANKS if I helped,
Best Regards,
AJ

---------- Post added at 05:32 PM ---------- Previous post was at 05:30 PM ----------



ok I'll use winrar and im just dragging my modded whatsapp PNG to the res/drawables-hdpi/ folder....

Press THANKS if I helped,
Best Regards,
AJ
Hey, push it to system/app and set right permissions, now it will be installed as system app, use link2sd to move to SD card or move it any where, not sure with this trick, you can try and report !
 
  • Like
Reactions: Abhinav1997

AryanAkanskh

Senior Member
Apr 26, 2012
130
80
0
Singapore
Yep I know I'm doing it in original file only... :(

Press THANKS if I helped,
Best Regards,
AJ

---------- Post added at 05:32 PM ---------- Previous post was at 05:30 PM ----------



ok I'll use winrar and im just dragging my modded whatsapp PNG to the res/drawables-hdpi/ folder....

Press THANKS if I helped,
Best Regards,
AJ
If u want an installable apk, scroll few page back and use the method I posted.

Sent from my ST15i using xda app-developers app
 
  • Like
Reactions: Abhinav1997

Abhinav1997

Inactive Recognized Developer / Retired Forum Mode
Jul 29, 2012
2,590
5,305
0
If u want an installable apk, scroll few page back and use the method I posted.

Sent from my ST15i using xda app-developers app
Yep, Stalin told me your method but then when I completely told what I have to do so both Stalin and sandy7 told me to use just winrar or 7zip to edit the images....anyways I'll try the winrar when I reach home...:) thnx sandy, Stalin and aryan :D

Press THANKS if I helped,
Best Regards,
AJ

---------- Post added at 06:37 PM ---------- Previous post was at 06:21 PM ----------

Hey, push it to system/app and set right permissions, now it will be installed as system app, use link2sd to move to SD card or move it any where, not sure with this trick, you can try and report !
Well that worked :D.....thnx a lot...sorry I couldn't thank everyone because of the limit :(

Press THANKS if I helped,
Best Regards,
AJ
 

™ God ™

Senior Member
Nov 27, 2012
637
134
0
Error
[*] "C:\Documents and Settings\Pictureville\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res"
recompiling "C:\Documents and Settings\Pictureville\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res"...
W: Could not find sources
I: Building resources...
(skipping index file 'C:\Documents and Settings\Pictureville\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res\res\drawable-hdpi\Thumbs.db')
C:\Documents and Settings\Pictureville\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res\res\drawable\stat_sys_battery.xml:1: error: Error parsing XML: not well-formed (invalid token)
C:\Documents and Settings\Pictureville\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res\res\drawable\stat_sys_battery_charge.xml:1: error: Error parsing XML: not well-formed (invalid token)
C:\Documents and Settings\Pictureville\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res\res\drawable\zzz_stat_sys_battery_1.xml:1: error: Error parsing XML: not well-formed (invalid token)
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\DOCUME~1\PICTUR~1\LOCALS~1\Temp\APKTOOL8942649231542658446.tmp, -x, -S, C:\Documents and Settings\Pictureville\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res\res, -M, C:\Documents and Settings\Pictureville\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res\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\PICTUR~1\LOCALS~1\Temp\APKTOOL8942649231542658446.tmp, -x, -S, C:\Documents and Settings\Pictureville\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res\res, -M, C:\Documents and Settings\Pictureville\Desktop\AutoAPKTool2.0.4\_INPUT_APK\framework-res\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:83)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
... 6 more
The system cannot find the drive specified.