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

stanlin salu

Senior Member
Apr 12, 2012
1,849
2,220
0
New Delhi
I hope u r changing the pngs in res/drawable-hdpi(or)mdpi(or)xdpi folder, the folder wil vary according to the device, I hope for changing the png, open the apk with 'winrar' and replacing the pngs, shld be enough!

Sent from my WT19i using xda premium
 

ClarkSt

Senior Member
Oct 29, 2010
123
3
0
I tried that, but it won't install. Could be the apk's I'm using aren't good for the Kindle Fire HD to begin with... double checking. But thanks! I'm using 7-zip. I just remake my png file to be twice the resolution, but the same size in pixels, right? then open the apk and copy the new png in and replace the current one then close the apk. Right? Thanks!
 

stanlin salu

Senior Member
Apr 12, 2012
1,849
2,220
0
New Delhi
I tried that, but it won't install. Could be the apk's I'm using aren't good for the Kindle Fire HD to begin with... double checking. But thanks! I'm using 7-zip. I just remake my png file to be twice the resolution, but the same size in pixels, right? then open the apk and copy the new png in and replace the current one then close the apk. Right? Thanks!
Yep!

Sent from my WT19i using xda premium
 

cuvix

Senior Member
Feb 15, 2012
68
23
0
Selong
Hi guys, could anyone confirm this:

Will the drag-drop META-INF folder from original system apk to recompiled one pass the boot process in fresh install of ROM?
Weather for pushing system apk or using flashable zip method will pass the booting process as long as we have system that already running, even without META-INF folder inside modified system apks. CMIIW. :rolleyes:
 

Ticklefish

Recognized Themer
Oct 27, 2011
6,743
8,534
263
Hampshire, UK
Hi guys, could anyone confirm this:



Weather for pushing system apk or using flashable zip method will pass the booting process as long as we have system that already running, even without META-INF folder inside modified system apks. CMIIW. :rolleyes:
The META-INF folder has the signing information for the apk. If the apk isn't signed, it won't install. At all.

Sent from my SK17i using xda premium
 

cuvix

Senior Member
Feb 15, 2012
68
23
0
Selong
The META-INF folder has the signing information for the apk. If the apk isn't signed, it won't install. At all.

Sent from my SK17i using xda premium
Exactly, but that was for the installable apks. have you tried TK's framework-res.apk mod?
He share the flash-able zip of framework-res.apk that doesn't contain META-INF inside the apk, that was what I mean.
And for information, drag-drop META-INF won't passes the installation when you want to install modified installable apk. We must sign it at least using the test key. That was why I ask like that above. ;)
 

Ticklefish

Recognized Themer
Oct 27, 2011
6,743
8,534
263
Hampshire, UK
Exactly, but that was for the installable apks. have you tried TK's framework-res.apk mod?
He share the flash-able zip of framework-res.apk that doesn't contain META-INF inside the apk, that was what I mean.
And for information, drag-drop META-INF won't passes the installation when you want to install modified installable apk. We must sign it at least using the test key. That was why I ask like that above. ;)
Depends what you mean by an installable apk. System app's (those found in system/app or system/framework) generally have to be signed the same way as the originals, which means using the same META-INF folder.

Market app's can possibly just be signed with a tool like testsign.

I don't know about that mod you mentioned but it could be a zip that just replaces certain files in an apk, instead of the whole apk itself.

Sent from my SK17i using xda premium
 

cuvix

Senior Member
Feb 15, 2012
68
23
0
Selong
Depends what you mean by an installable apk. System app's (those found in system/app or system/framework) generally have to be signed the same way as the originals, which means using the same META-INF folder.

Market app's can possibly just be signed with a tool like testsign.

I don't know about that mod you mentioned but it could be a zip that just replaces certain files in an apk, instead of the whole apk itself.

Sent from my SK17i using xda premium
Here download TK's framework-res.apk mod here.
Taken from his thread:
[APP][MOD] Xperia NXT for ICS 4.0.4 [UPDATE: 6/14/2012]



You will find out what I mean. ;)

When I was in Galaxy Young long-long ago, I found out this.
Maybe that was because when we first install ROM, the required start-up applications and jar files cached (let's say installing, and installing requires the well signed apks).
IMHO when we install a flash-able zip or push any system apk, the system itself just read apk's resources, not the signature.
And you can believe me or not, you don't need the sony signature for it system apks when installing custom ROM as long as you use the right type of signature (they are platform -> this one is the core files [framework-res.apk, SemcGenericUxpRes.apk and Settings.apk], media, shared, etc.). I've tried it myself and successfully install my custom custom ROM (yo dawg, because I custom the custom ROM :p) :D
 

AryanAkanskh

Senior Member
Apr 26, 2012
130
80
0
Singapore
Here's what i did

I tried to modify a user apk. I just wanted to change the icon of an app. I just reverted to ICS and now am using 4 corner stock launcher. one can understand it doesnt let us to change icon like GO,ADW or NOVA...etc...(obvious i know. just to mention) so i thought of modifying the apk itself.

Now enough of the nattering.. i will proceed to tell what happened.


  • * I tried ur tool, followed the instructions as said but no avail, app failed to install(the apk file copied from _OUT_APK).
    * I understood it must be framework r signing prob. Tried option 10, only to discover it signs only ZIPs. I dont want a ZIP.
    * Tried option "Rebuild usable APK" -failed. app not installed.
    * Tried changing png file using WINRAR-app not installed. Second time, copied META-INF to modifed apk- Failed

    So a little bit of googling, gave me the below method. Which works perfectly fine.

    Heads-up : I DINT TRY FOR SYSTEM APP!

    # I downloaded apktool from here : ApkTool.
    #Download the first two files, extract the two files to single folder.
    #There must be 3 files.
    # Copy the apk to be modified to the created folder.
    # run cmd
    # move to the created folder and type apktool if contact-to-be-decompiled.apk
    - Example apktool if phone.apk
    # type apktool d contact-to-be-decompiled.apk folder-name-of-decompiled-files
    - Example apktool d phone.apk phone
    # play around the pngs or xmls
    # to recompile type apktool b folder-name apk-new.apk
    - Example apktool b phone phone-new.apk
    # Now u have the apk file.

    # download SignApk

    # copy the new apk to extracted signapk folder.
    # open cmd move to the directory type java -jar signapk.jar certificate.pem key.pk8 your-app.apk your-app-signed.apk
    -Example - java -jar signapk.jar certificate.pem key.pk8 phone-new.apk phone-signed.apk

# after all these the signed apk installed on my phone. piece of cake. :)

That being said, i am thinking of making a more detailed procedure in case its difficult or not clear.

Guys i dont know how much this post will be useful. I am no expert. But if any1 tried and had positive results, share. Dont forget to press Thanks!
 

Ticklefish

Recognized Themer
Oct 27, 2011
6,743
8,534
263
Hampshire, UK
I tried to modify a <b>user apk</b>. I just wanted to change the icon of an app. I just reverted to ICS and now am using 4 corner stock launcher. one can understand it doesnt let us to <b>change icon</b> like GO,ADW or NOVA...etc...(obvious i know. just to mention) so i thought of modifying the apk itself.<br />
<br />
Now enough of the nattering.. i will proceed to tell what happened.<br />
* I tried ur tool, followed the instructions as said but no avail, app failed to install(the apk file copied from _OUT_APK). <br />
* I understood it must be framework r signing prob. Tried option 10, only to discover it signs only ZIPs. I dont want a ZIP.<br />
* Tried option "Rebuild usable APK" -failed. app not installed.<br />
* Tried changing png file using WINRAR-app not installed. Second time, copied META-INF to modifed apk- Failed<br />
<br />
So a little bit of googling, gave me the below method. Which works perfectly fine. <br />
<br />
<b>Heads-up :</b> <b><font color="DarkRed">I DINT TRY FOR SYSTEM APP!</font></b><br />
<br />
# I downloaded <b>apktool </b>from here : ApkTool.<br />
#Download the first two files, extract the two files to single folder. <br />
#There must be 3 files.<br />
# Copy the apk to be modified to the created folder.<br />
# run cmd<br />
# move to the created folder and <b>type apktool if <font color="Sienna">contact-to-be-decompiled.apk</font></b><br />
- Example apktool if phone.apk<br />
#<b> type apktool d <font color="Sienna">contact-to-be-decompiled.apk</font><font color="DarkOliveGreen"> folder-name-of-decompiled-files</font></b><br />
- Example apktool d phone.apk phone<br />
# play around the pngs or xmls<br />
# to recompile <b>type apktool b <font color="DarkOliveGreen">folder-name</font> <font color="DarkRed">apk-new.apk</font></b><br />
- Example apktool b phone phone-new.apk<br />
# Now u have the apk file.<br />
<br />
# download SignApk<br />
<br />
# copy the new apk to extracted signapk folder.<br />
# open cmd move to the directory <b>type java -jar signapk.jar certificate.pem key.pk8 your-app.apk your-app-signed.apk</b><br />
-Example <b>- java -jar signapk.jar certificate.pem key.pk8 <font color="DarkOliveGreen">phone-new.apk</font> </b><font color="DarkRed">phone-signed.apk</font><br />
<br />
# after all these the signed apk installed on my phone. piece of cake. :)<br />
<br />
That being said, i am thinking of making a more detailed procedure in case its difficult or not clear.<br />
<br />
Guys i dont know how much this post will be useful. I am no expert. But if any1 tried and had positive results, share. Dont forget to press Thanks!
Of course, my standard response is 'Try Tickle My Android'..

But well done for your hard work. And well done for not going crazy trying to work out how to do it! :)

If you're just replacing PNG's with others with the same name, you should just be able to open the apk with winrar or 7zip and swap the files over. Why wasn't it working for you?

Sent from my SK17i using xda premium
 

stanlin salu

Senior Member
Apr 12, 2012
1,849
2,220
0
New Delhi
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:

Don't Mistake My Kindness For Weakness
 

AryanAkanskh

Senior Member
Apr 26, 2012
130
80
0
Singapore
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:

Don't Mistake My Kindness For Weakness
Thanks man..!

---------- Post added 28th January 2013 at 12:08 AM ---------- Previous post was 27th January 2013 at 11:59 PM ----------

Of course, my standard response is 'Try Tickle My Android'..

But well done for your hard work. And well done for not going crazy trying to work out how to do it! :)

If you're just replacing PNG's with others with the same name, you should just be able to open the apk with winrar or 7zip and swap the files over. Why wasn't it working for you?

Sent from my SK17i using xda premium
I dont know sir. But i was not able to get the app to install. Tried several times.
The other day I managed to use serajr JB style status bar in xNxT rom by copying the METAINF from the ROM to the mod. I just dnt know whats wrong.

BTW, Trickle My Android is cool ! now why didnt i think of that before..:confused: Good work.