[Advice/Reference/Guide] The Definitive APK Modding & Theming Thread... [12/08/13]

Search This thread

SXUsr

Senior Member
Jul 11, 2010
8,161
2,877
Here =)
[Advice/Reference/Guide] The Definitive APK Modding & Theming Thread... [12/08/13]

x1x75l.png

This is why I love Virtuous Ten, as you can install multiple resources. :)
wow, i didnt know there is tools like that
After reading jacknb1ack's comment I felt compelled to re-write this whole thread to accommodate for the various PC Programs that you use to do all of your apk modding which can and do make things a hell of a lot quicker. :) I've wrote this as something I would have liked to have come across when I first joined because I know there is a lot to take in, and hearing you need to decompile, edit this or that xml, recompile, sign etc etc etc can be off putting for some especially if you struggle to get a program or apktool setup to begin with.

Knowing how to use command prompts will be beneficial in the long run so I've wrote a detailed guide below which covers it from start to finish along with how to Sign and Zipalign your apks, pulling them from the computer and so on. I've also covered some Theming basics with links to everything you're ever going to need, which will be extra handy if you're just getting started. :)

66xncx.jpg
Minimum Requirements:


Theming Requirements:
  • Notepad++
  • Photoshop, GIMP or any other image editing software.
  • Patience. :silly:

66xncx.jpg

To avoid any java not found issues you need to set up the PATH for it in Environment Variables, you can find a short Guide on how to HERE. This is how mine looks...

PATH.png

Code:
[B]C:\Program Files (x86)\Java\jre6\bin;[/B]

I would advise that you also install the Android SDK but if you don't want to you can download this APK_Mod.zip that you can extract to a folder and place it anywhere you want on your Computer (I recommend C:\APK_Mod) and run any adb, apktool, zipalign or signing command prompts from it. You can find a more detailed guide for this method below.

But first off all here are some of the most common Programs that you can use to modify and theme your apks, and I'll start with one of the best...

66xncx.jpg



Virtuous Ten Studio (VTS)

30xg280.png

Virtuous Ten Studio (VTS) is the ultimate solution for the modification of android applications.
This program allows you to manage entire Android projects within an easy to use and familiar environment.

The intended group of users covers anyone from a themer over ROM devs up to the smali gods known for their awesome mods of existing apks.
The modifcation of smali code is one of the biggest features in VTS. You can easily decompile, edit and recompile any apk or jar file.
However, the application is not limited to smali files. You can edit almost any file found inside an apk or jar.

Virtuous Ten Studio is also the official successor to the highly important M10Tools released last year by the Virtuous Team.
You can easily edit any m10 file from Sense apps in order to resize or change them.

Additionally VTS brings support for un- and repacking of boot images (boot.img), a job that previously required a cygwin installation with the dsixda kitchen.
Since VTS' own implementation is a native windows solution, which means you don't need dsixda or cygwin anymore.

VTS has been designed to run on Windows, has been in development for nearly two years and has gone through many stages of testing.


Today VTS is a highly respected full blown Android IDE (Integrated Develoment Environment) suited for all your reverse engineering tasks.
- www.virtuous-ten-studio.com

66xncx.jpg


AndroidSuite 2013

33vlzxj.png

AndroidSuite 2013 what it does
  • Decodes and encodes Dex files
  • Decodes and encodes APK files (Previously bugged in APKManager)
  • Gives a console output
  • Flash boot.img (fastboot)
  • Flash update.zip (fastboot)
  • reboot/reboot fastboot mode
  • Sign unsigned apks
- (App) Androidsuite 2013 v117 (01/04/2013) Jelly Bean Support!

66xncx.jpg


Tickle My Android 5.4

2z8xmxt.png

Tickle My Android, or TMA for short, is a command line tool for Windows that uses apktool to help you pull and decompile files from your Android phone or tablet.

But it can also:

  • change the battery icon,
  • change the WiFi icon,
  • change the signal icon,
  • change the emoticons,
  • change the notification toggles,
  • change the transparency of the statusbar (if the rom allows it),
  • add Ice-Cream Sandwich-style transitions
  • zipalign apk files,
  • sign new apk files,
  • sign recompiled apk files in the same way as the original,
  • deodex apk and jar files,
  • backup personal data and transfer to a brand new device,
  • resize and change boot animations,
  • change fonts,
  • add sounds from other devices,
  • create backup-generating flashable zip files
  • ..and now comes in Portuguese and French!!
- [TOOL]Tickle My Android 5.4 - DE/RECOMPILE APPS, CHANGE ICONS...AND MORE!!!!

66xncx.jpg


ApkManager V6.1

3096d6p.png

1. Based on ApkManager 4.9 by Daneshm90 (Big thanks to him)
2. Updated Apktool V1.5.2 by iBotPeaches & Brut.Alll
3. Updated Aapt v0.2
4. Default compression level set to “0?
5. 512Mo as default allowed heap size
6. 3 ready for use fake frameworks : “other\wanam1.apk”… (for Lidroid framework editing)
7. Add a “Decompile all files” feature (option 25)
- wanamlite.com

66xncx.jpg



Command Prompt Editing

Basically this is just manually doing what all of the programs above need to do in order to decompile, recompile, sign and zipalign apks so it's worth knowing how to modify apks this way for occasions when the above programs for whatever reason gives you issues.

Use Linux or a Mac?

See the following threads for more information on using apktool on other Operating Systems...

APK Manager for Mac OS X

[Linux][UTILITY][TOOL] APK Multi-Tool

[tutorial] decompiling,recompiling and signing in linux (27-01-2013)

How to install and use Apktool with Ubuntu



66xncx.jpg


Getting APKs To Your PC

You have two options here...

1. Use a file manager on your Phone to copy and paste files to your SD, then connect to your PC and use Windows Explorer to copy and paste to your desired location.

2. ADB. Open a command prompt window in the ADB folder (see below) and type/copy the following command...

Code:
adb pull /system/app/ Original_apps

...which will pull the whole app folder to your computer and create a new folder called Original_apps, which you can then simply copy apps to the main folder ready to be modified (keep the Original_apps folder as a backup). Then do the same for your framework folder...

Code:
adb pull /system/framework/ Original_framework

...want to pull your Phones whole system...

Code:
adb pull /system/ Xperia_Z_System

...you can rename "Xperia_Z_System" to whatever you want.

Further Information: [WINDOWS][TUT]ADB tutorial, setting up ADB, usefull commands, collecting debug info.

This is a zip of the apktool folder I currently use - APK_Mod.zip - which as said above also contains the ADB files needed to pull and push apps from your Phone, or you can check out the following links...
66xncx.jpg



Installing Resources

For apktool to work you need to install the resources needed by your apks for de and recompiling, and those resources are other apks, the first apk regardless of your Phones manufacturer is going to be your framework-res.apk. The second apk you need is dependent on the manufacturer so you need to check your framework folder for another apk such as twframework.apk or SemcGenericUXpres.apk, in some cases it might even be the SystemUI.apk but you would need to check if you have issues with the other two. Put those two apks in the APK_Mod folder to begin with then open a command prompt window. The easiest way for me is holding the shift key then right clicking the mouse and selecting Open command window here, but if you're not able to do that then click your Start button and search for Command Prompt, then open it. You then need to point it to the relevant folder, so type cd then copy and paste the location of the folder (cd C:\APK_Mod) and hit enter.


The install commands are...

Code:
[B]apktool if[/B] framework-res.apk

...and for the second...

Code:
[B]apktool if[/B] SemcGenericUXpres.apk

66xncx.jpg

Decompiling

The command for decompiling is...

Code:
[B]apktool d[/B] framework-res.apk

...and so on for each individual apk you want to modify. A new folder will be created that is named after the apk you are modding, then you can edit xmls, smali files and .9png images. You'll notice that there are a lot more folders when you decompile an apk, that's normal as those folders are from the resources.arsc and where you'll find the xml files you may need to edit to make the changes you want.

decomp1.png


66xncx.jpg



Recompiling

When you've done editing it's time to recompile, using the command...

Code:
[B]apktool b[/B] -insert folder name-

...and if you've edited your files correctly then it should compile with no errors and create a folder named dist in the decompiled folder along with a new apk.

build1.png


66xncx.jpg



Signing

Before using the new apk you will need to sign it, to do this you need to extract (open the apk and simply drag and drop them to the dist folder) from the original apk the resources.arsc (only if you haven't changed anything in the values folder, the AndroidManifest.xml and META-INF folder (if it exists), then copy them into the new apk. In WinRar it will give you the option to choose the compression method, and it's vital that you choose Store as the compression method because if you don't then you WILL BOOT LOOP after restarting your Phone!

store.png


NOTE: If you have edited anything in the values folder then extract the resources.arsc from the new apk and copy (drag and drop) it back in the same manner described above.

Orig_new.png

Alternatively you can use the following command...

Code:
[B]java -jar signapk.jar testkey.x509.pem testkey.pk8[/B] framework-res.apk.apk framework-resS.apk

...notice the extra "S", the output name has to differ from the input name otherwise it will give an error, if done right it will create a new apk called framework-resS.apk, just remember to rename it back to the original before using it on your Phone.


Signing For The Play Store

If you plan on Publishing a Theme or any other app/apk to the Play Store then using the above method to sign your apks just wont work because you need to give it an individual signature that is unique to you, thankfully @AndroidGraphix has written a great guide that will show you how, it's a bit more fidgety than the above method but simple enough to follow...


- Noobs guide to signing an APK with a Private Key

66xncx.jpg



Zipaligning

DISADVANTAGES OF UNALIGNED APKs

Quite understandably, situation would be reserved for unaligned application packages. Resource reading would be slow and memory usage would be on the higher end of the spectrum. It would also depend on how many unaligned applications are present. For example, if less number of applications with an unaligned home application, you’d see slower application launch times. This is the best case scenario. For a worst case scenario, having a number of unaligned applications will result in the system repeatedly starting and killing processes, struggling with lags and huge battery drain.

- SOURCE

The command for zipaligning is...

Code:
[B]zipalign -v 4[/B] framework-res.apk ZAframework-res.apk

...notice the "ZA", again that can be anything you want so long as it differs from the original name, I use ZA for an obvious reason, and again don't forget to rename it before using on your Phone.

66xncx.jpg



Getting apks back to your Phone

It's just a reversal of how you got them off your Phone to begin with, use a file explorer and put your apk on your SD Card, then move it to the Phones System folder and change it's permissions to rw-rw-r, then move and replace it with the original. Most apps should continue to work but if you change your framework-res or SystemUI you will most likely need to reboot. Or you can use adb to push and install them. Check the previous link for the commands.

If all the above has worked correctly you should now have your modified apk installed with the changes you've made displayed on your Phone. :)

66xncx.jpg



Theming & Modifying

This is where the fun begins, once you've got setup to decompile your apks then obviously you're going to want to mod them, so here's a few pointers to clear up what seems like a daunting process to new comers... :)

To start with you'll probably just want to start with replacing images, so if that's all you want to do for now then here's a quick tip, you DON'T need to decompile or sign your apks!, simply edit and rename your replacment images on you computer, preferably using the same or similar dimensions then drag and drop them back into the right folders in the apk, always using Store as the compression method, but PLEASE NOTE; .9 pngs can be replaced in the same way, but if you want to edit them in Photoshop for example then you need DO need to decompile them.

A few things to note...


  • Smali code is real Developer territory, it's Matrix code to me :p, thankfully there's usually a guide to follow so you can simply copy and paste code without having to fully understand how it works, so don't fret about this.

    .9pngs are simply png images with a 1 pixel border. You can edit anything within that border but anything on or over will give errors when building. Unless you're creating an image from scratch then you can leave the border as it is, it's that simple! Sure there's a bit more to .9png editing but you can find a few links below that go into more detail about .9s and how they work.

    xmls are relatively simple and edited with Notepad++, much simpler to understand than smali and again, there's usually a guide to be found for most mods you may want to make yourself, but if you're feeling brave you can experiment with it when you have a basic understanding of how it works.

    Restoring modified files if you mess up is easier and quicker with a CWM.zip, especially if you're modifying any framework apks! Just because an apk might build with no errors doesn't mean it won't give you any when installed to the Phone.
66xncx.jpg



.9png Editing

I hope after reading this explanation you're left wondering what all the fuss is about, as it really is quite simple. :) I'll use the following two images, btn_default_pressed_holo.9 & status_bar_close_off.9 to illustrate the basic point of the borders...

Decompiled .9pngs:

2ivffib.png
m91yz6.png

Recompiled .9pngs:

34owzyq.png
33ae238.jpg

Those borders control which part of the image is stretched, and we'll use Draw 9-patch which is for editing the borders of decompiled .9pngs and lets you see how the image, when stretched, will be displayed on the Phone. Notice that the borders are different sizes, well that's because I only want/need a certain part of the image to stretch to get the desired look on the Phone.

4tx8up.png

...in the image below the left side shows the stretched image and desired effect should look on the Phone and the right side shows how it would look if I had edited the borders incorrectly or used none at all...

25aizyo.png

You can get away by not using a border but you would need to edit your image to specific dimensions to accommodate for the stretching, for example it might look fine for a simple OK button but it might not look right if you used the same .9png for a screen press which stretches the whole length of the screen, so you're better off just using them to begin with, plus you'll more than likely get errors down the line while decompiling or recompiling your apk.

The use of the border is made even more clear when you add text to an image. For my status_bar_close_off.9 I've filled all four sides of the image (except for an empty pixel in all four corners as that is the max amount of border you can use) as I need it to stretch the image just how I've edited it...

o0ym13.png

...but if I used the same sized left side border as the btn_default_pressed_holo.9 then this is how it would look on the Phone...

2m639kz.png

...which is obviously not the look I'm trying to achieve, as the left side border is causing the image to stretch incorrectly.

So that's basically it, depending on the image you're editing you can usually leave the borders alone but if you create one from scratch then you might need to play about with them if your images doesn't look quite right when used on the Phone. Here's a few links that will assist you further, especially the batch editing...



66xncx.jpg



Xposed Framework

In this thread, I'm presenting a framework which gives you the possibility to modify your ROM - without modifying any APK (developers) or flashing (users)! :)
...
Advantages:
  • No need to modify any APKs. This means:
  • No need to decompile, change things in smali, compile, sign, ...
  • It will work for odexed and deodexed ROMs.
  • Your mod is not bound to a specific version of the ROM. Unless there is a major change in the methods called for a certain functionality, your mod will continue to work even when you upgrade your ROM. Hell, it will probably even work with different ROMs.
  • Multiple mods can be installed at the same time, even if they change the same package. So you can use these battery icons and those quick toggles. Even hooking the same method twice is possible. Of course, this only works properly if the mods are not trying to do incompatible things.
  • It does its magic at runtime. That means you can implement options to let the user decide if they prefer the bikeshed to be painted in red or blue. Or you can have some extra logic for certain ROMs without building different mod versions.
  • It can be disabled easily without having to reflash.
  • It's open source.
Screenshot_2012-04-05-19-32-42.png

- [FRAMEWORK ONLY!] Xposed - ROM modding without modifying APKs


66xncx.jpg



CyanogenMod Theme Chooser

CM10.1-THEME_BOOK

Theme book was created by Annex and Ebs512. I've been asked alot of questions from how to get started? what do I need to get started? to What Graphics program do I use? etc. We made a real simple theme guide to help get you started. This is in Layman Terms.. Nothing fancy.

ONLY THING FANCY IS MY FLASH BOOK :D
YOU MUST HAVE A FLASH PLAYER INSTALLED TO VIEW THIS!!!

av0s2r.png

- [GUIDE] HOW TO THEME CM10.1 - Animated Book


See a few post below for more...
 
Last edited:

chitose_ndy

Senior Member
Jan 30, 2011
1,756
193
30
Jakarta
Thank you so much,
This should be sticky!

Make a noob, into a senior user.
:p

Sent from my Anzu using xda premium
 

SXUsr

Senior Member
Jul 11, 2010
8,161
2,877
Here =)
Flashable Clockwork Mod (CWM) zip

ClockworkMod Recovery zips are used for flashing individual files to whole ROMS and can be a life saver if you push a badly edited apk to your Phone that results in a bootloop. There's also a few programs that can assist you with that too, but if all you're doing is replacing a few files all you really need is a template, then it's just a matter of creating the Phones folder setup in the zip which is simply creating folders: system\app - system\media\audio etc then dragging and dropping your files into it. A basic understanding of the updater script is essential, a ROM.zip will more than likely wipe your Phone whereas a Theme.zip may just replace files but it might delete some also.


See below for a CWM.zip Template but first some helpful links...



This is my Theme_CMW_Template.zip which is set up so you can add your own files to the framework and apps folders in the main system location, but you can easily add other folders to it if you want to add things like fonts, tones or anything else, just remember to add folders within folders if that's where the files you want to include are such as tones, media\audio\alarms for example.

If you navigate to META-INF\com\google\android you will find the updater-script which controls how the zip works and the text you see when you run it in CWM. As this zip is just for basically over writing files you don't need to edit anything except for a few lines...

np.png

...this is how I've edited it for my Ice Green ResMods theme...

np1.png

...so just edit it using Notepad++ to your liking.

When adding files to your zip add them using Normal as the Compression Method...

3.png

...and that's pretty much it. Remember to remove the text files I've added otherwise they will be flashed to your folders too.


66xncx.jpg


Deodexing


The first thing I do when installing the latest firmware is Deodex it, mainly because having a deodexed ROM is easier to modify and you'll find a lot of the modifications that are are in the Themes And Apps sections require you to have a deodexed ROM. I use the dsixda's Android Kitchen to deodex and @pankaj88 has written a great guide here - [GUIDE] How to DEODEX stock ODEXED ROM using dsixda's kitchen - so you can do it yourself, or you can give the following tools a try. :)

The differences between Odex and Deodex Files...

In Android file system, applications come in packages with the extension .apk. These application packages, or APKs contain certain .odex files whose supposed function is to save space The odexed file structure works well as an optimization tool. Since these .odex files contain preliminary load information about each system app, the OS knows what to expect when it’s booting up, and consequently, loads all these apps faster.
On the other hand, it also makes hacking those applications difficult because a part of the coding has already been extracted to another location before execution.

For instance, on a non-rooted device you’ll find
system/app/Phone.apk ===> as well as ===> system/app/Phone.odex

- [GUIDE] - The differences between Odex and Deodex Files

66xncx.jpg



[TOOL][WINDOWS]Universal Deodexer[ALL DEVICES!!]

Hi everyone,

Alokbina and I have created a tool which allows users to very easily deodex apks from a rom. This tool is very useful for Rom developers too.:) For now only windows is supported but we will try our best to make the same tool for linux too and make the tool as user friendly as possible. And, please don't forget to thank alokbina too.

NOW EVEN ON XDA PORTAL - http://www.xda-developers.com/android/deodex-all-the-things-with-universal-deodexer/

Requirements:-
--->Java installed on your PC
--->system/framework folder from your rom
--->apks from that SAME ROM with the respective .odex file
--->Patience and a calm head (common sense included)


You can watch this video for setting up and using the tool -

[FIXED][UPDATE - V3][TOOL][WINDOWS]Universal Deodexer[ALL DEVICES!!]

66xncx.jpg


CARBONITE TOOL
Features
1)Deodex your stock ROM (android 2.x 3.x 4.x)
2)This tool automatically pull your apps from phone to PC
3)One click deodexer,
4)Just click Deodexer_from_phone
5)All apps and framework will be deodexed.
6)Automatically makes .zip file flash from CWM.

BUGS
Sometimes it does not deodex androidpolicy.jar just run script once again!
- [TOOL]CARBONITE TOOL [Dedeoxder tool][All devices]

66xncx.jpg


And that's pretty much it, the only way you're really going to learn is by reading then putting into practice what you've read and picking stuff up along the way, fortunately this far into the history of Android there are numerous guides for numerous mods and tools to help with a variety of tasks and the following links are going to be a big help...



U.I Modding
Text...
Statusbar...
Misc...

Various Tools...


Useful Links



If you feel something more should be added to this thread please feel free to suggest it. :)


Credits & Thanks:

@_calum_
@Diamondback
@ebs512
@Rizal Lovins
@Ticklefish
@wanam
@rovo89
@Annex1
@ebs12

And not forgetting @iBotPeaches and @Brut.all for making it possible with - [UTIL][Feb 02 2013] Apktool v1.5.2 - a tool for reverse engineering apk files
 
Last edited:

abhisheak.bansal

Senior Member
May 30, 2011
524
71
Delhi
one query
after i decompile the apk,i edit the my xmls in project folder....then what to do next?

EDIT:- I figured it out
 
Last edited:

Kajendran

Senior Member
Mar 18, 2012
176
15
Colombo
www.facebook.com
Could you make a short guide to show
how to zipalign using dsixda's Android Kitchen

When I select zipalign all...
It says no working folder found...
what does it mean...?
 
Last edited:

OverLo4d

Senior Member
Mar 25, 2012
433
375
Ness Ziona
when i try to install the resources i get this error:
Code:
'java' is not recognized as an internal or external command,
operable program or batch file.
i have java installed, what am i doing wrong?:(:confused:
 

Top Liked Posts

  • There are no posts matching your filters.
  • 45
    [Advice/Reference/Guide] The Definitive APK Modding & Theming Thread... [12/08/13]

    x1x75l.png

    This is why I love Virtuous Ten, as you can install multiple resources. :)
    wow, i didnt know there is tools like that
    After reading jacknb1ack's comment I felt compelled to re-write this whole thread to accommodate for the various PC Programs that you use to do all of your apk modding which can and do make things a hell of a lot quicker. :) I've wrote this as something I would have liked to have come across when I first joined because I know there is a lot to take in, and hearing you need to decompile, edit this or that xml, recompile, sign etc etc etc can be off putting for some especially if you struggle to get a program or apktool setup to begin with.

    Knowing how to use command prompts will be beneficial in the long run so I've wrote a detailed guide below which covers it from start to finish along with how to Sign and Zipalign your apks, pulling them from the computer and so on. I've also covered some Theming basics with links to everything you're ever going to need, which will be extra handy if you're just getting started. :)

    66xncx.jpg
    Minimum Requirements:


    Theming Requirements:
    • Notepad++
    • Photoshop, GIMP or any other image editing software.
    • Patience. :silly:

    66xncx.jpg

    To avoid any java not found issues you need to set up the PATH for it in Environment Variables, you can find a short Guide on how to HERE. This is how mine looks...

    PATH.png

    Code:
    [B]C:\Program Files (x86)\Java\jre6\bin;[/B]

    I would advise that you also install the Android SDK but if you don't want to you can download this APK_Mod.zip that you can extract to a folder and place it anywhere you want on your Computer (I recommend C:\APK_Mod) and run any adb, apktool, zipalign or signing command prompts from it. You can find a more detailed guide for this method below.

    But first off all here are some of the most common Programs that you can use to modify and theme your apks, and I'll start with one of the best...

    66xncx.jpg



    Virtuous Ten Studio (VTS)

    30xg280.png

    Virtuous Ten Studio (VTS) is the ultimate solution for the modification of android applications.
    This program allows you to manage entire Android projects within an easy to use and familiar environment.

    The intended group of users covers anyone from a themer over ROM devs up to the smali gods known for their awesome mods of existing apks.
    The modifcation of smali code is one of the biggest features in VTS. You can easily decompile, edit and recompile any apk or jar file.
    However, the application is not limited to smali files. You can edit almost any file found inside an apk or jar.

    Virtuous Ten Studio is also the official successor to the highly important M10Tools released last year by the Virtuous Team.
    You can easily edit any m10 file from Sense apps in order to resize or change them.

    Additionally VTS brings support for un- and repacking of boot images (boot.img), a job that previously required a cygwin installation with the dsixda kitchen.
    Since VTS' own implementation is a native windows solution, which means you don't need dsixda or cygwin anymore.

    VTS has been designed to run on Windows, has been in development for nearly two years and has gone through many stages of testing.


    Today VTS is a highly respected full blown Android IDE (Integrated Develoment Environment) suited for all your reverse engineering tasks.
    - www.virtuous-ten-studio.com

    66xncx.jpg


    AndroidSuite 2013

    33vlzxj.png

    AndroidSuite 2013 what it does
    • Decodes and encodes Dex files
    • Decodes and encodes APK files (Previously bugged in APKManager)
    • Gives a console output
    • Flash boot.img (fastboot)
    • Flash update.zip (fastboot)
    • reboot/reboot fastboot mode
    • Sign unsigned apks
    - (App) Androidsuite 2013 v117 (01/04/2013) Jelly Bean Support!

    66xncx.jpg


    Tickle My Android 5.4

    2z8xmxt.png

    Tickle My Android, or TMA for short, is a command line tool for Windows that uses apktool to help you pull and decompile files from your Android phone or tablet.

    But it can also:

    • change the battery icon,
    • change the WiFi icon,
    • change the signal icon,
    • change the emoticons,
    • change the notification toggles,
    • change the transparency of the statusbar (if the rom allows it),
    • add Ice-Cream Sandwich-style transitions
    • zipalign apk files,
    • sign new apk files,
    • sign recompiled apk files in the same way as the original,
    • deodex apk and jar files,
    • backup personal data and transfer to a brand new device,
    • resize and change boot animations,
    • change fonts,
    • add sounds from other devices,
    • create backup-generating flashable zip files
    • ..and now comes in Portuguese and French!!
    - [TOOL]Tickle My Android 5.4 - DE/RECOMPILE APPS, CHANGE ICONS...AND MORE!!!!

    66xncx.jpg


    ApkManager V6.1

    3096d6p.png

    1. Based on ApkManager 4.9 by Daneshm90 (Big thanks to him)
    2. Updated Apktool V1.5.2 by iBotPeaches & Brut.Alll
    3. Updated Aapt v0.2
    4. Default compression level set to “0?
    5. 512Mo as default allowed heap size
    6. 3 ready for use fake frameworks : “other\wanam1.apk”… (for Lidroid framework editing)
    7. Add a “Decompile all files” feature (option 25)
    - wanamlite.com

    66xncx.jpg



    Command Prompt Editing

    Basically this is just manually doing what all of the programs above need to do in order to decompile, recompile, sign and zipalign apks so it's worth knowing how to modify apks this way for occasions when the above programs for whatever reason gives you issues.

    Use Linux or a Mac?

    See the following threads for more information on using apktool on other Operating Systems...

    APK Manager for Mac OS X

    [Linux][UTILITY][TOOL] APK Multi-Tool

    [tutorial] decompiling,recompiling and signing in linux (27-01-2013)

    How to install and use Apktool with Ubuntu



    66xncx.jpg


    Getting APKs To Your PC

    You have two options here...

    1. Use a file manager on your Phone to copy and paste files to your SD, then connect to your PC and use Windows Explorer to copy and paste to your desired location.

    2. ADB. Open a command prompt window in the ADB folder (see below) and type/copy the following command...

    Code:
    adb pull /system/app/ Original_apps

    ...which will pull the whole app folder to your computer and create a new folder called Original_apps, which you can then simply copy apps to the main folder ready to be modified (keep the Original_apps folder as a backup). Then do the same for your framework folder...

    Code:
    adb pull /system/framework/ Original_framework

    ...want to pull your Phones whole system...

    Code:
    adb pull /system/ Xperia_Z_System

    ...you can rename "Xperia_Z_System" to whatever you want.

    Further Information: [WINDOWS][TUT]ADB tutorial, setting up ADB, usefull commands, collecting debug info.

    This is a zip of the apktool folder I currently use - APK_Mod.zip - which as said above also contains the ADB files needed to pull and push apps from your Phone, or you can check out the following links...
    66xncx.jpg



    Installing Resources

    For apktool to work you need to install the resources needed by your apks for de and recompiling, and those resources are other apks, the first apk regardless of your Phones manufacturer is going to be your framework-res.apk. The second apk you need is dependent on the manufacturer so you need to check your framework folder for another apk such as twframework.apk or SemcGenericUXpres.apk, in some cases it might even be the SystemUI.apk but you would need to check if you have issues with the other two. Put those two apks in the APK_Mod folder to begin with then open a command prompt window. The easiest way for me is holding the shift key then right clicking the mouse and selecting Open command window here, but if you're not able to do that then click your Start button and search for Command Prompt, then open it. You then need to point it to the relevant folder, so type cd then copy and paste the location of the folder (cd C:\APK_Mod) and hit enter.


    The install commands are...

    Code:
    [B]apktool if[/B] framework-res.apk

    ...and for the second...

    Code:
    [B]apktool if[/B] SemcGenericUXpres.apk

    66xncx.jpg

    Decompiling

    The command for decompiling is...

    Code:
    [B]apktool d[/B] framework-res.apk

    ...and so on for each individual apk you want to modify. A new folder will be created that is named after the apk you are modding, then you can edit xmls, smali files and .9png images. You'll notice that there are a lot more folders when you decompile an apk, that's normal as those folders are from the resources.arsc and where you'll find the xml files you may need to edit to make the changes you want.

    decomp1.png


    66xncx.jpg



    Recompiling

    When you've done editing it's time to recompile, using the command...

    Code:
    [B]apktool b[/B] -insert folder name-

    ...and if you've edited your files correctly then it should compile with no errors and create a folder named dist in the decompiled folder along with a new apk.

    build1.png


    66xncx.jpg



    Signing

    Before using the new apk you will need to sign it, to do this you need to extract (open the apk and simply drag and drop them to the dist folder) from the original apk the resources.arsc (only if you haven't changed anything in the values folder, the AndroidManifest.xml and META-INF folder (if it exists), then copy them into the new apk. In WinRar it will give you the option to choose the compression method, and it's vital that you choose Store as the compression method because if you don't then you WILL BOOT LOOP after restarting your Phone!

    store.png


    NOTE: If you have edited anything in the values folder then extract the resources.arsc from the new apk and copy (drag and drop) it back in the same manner described above.

    Orig_new.png

    Alternatively you can use the following command...

    Code:
    [B]java -jar signapk.jar testkey.x509.pem testkey.pk8[/B] framework-res.apk.apk framework-resS.apk

    ...notice the extra "S", the output name has to differ from the input name otherwise it will give an error, if done right it will create a new apk called framework-resS.apk, just remember to rename it back to the original before using it on your Phone.


    Signing For The Play Store

    If you plan on Publishing a Theme or any other app/apk to the Play Store then using the above method to sign your apks just wont work because you need to give it an individual signature that is unique to you, thankfully @AndroidGraphix has written a great guide that will show you how, it's a bit more fidgety than the above method but simple enough to follow...


    - Noobs guide to signing an APK with a Private Key

    66xncx.jpg



    Zipaligning

    DISADVANTAGES OF UNALIGNED APKs

    Quite understandably, situation would be reserved for unaligned application packages. Resource reading would be slow and memory usage would be on the higher end of the spectrum. It would also depend on how many unaligned applications are present. For example, if less number of applications with an unaligned home application, you’d see slower application launch times. This is the best case scenario. For a worst case scenario, having a number of unaligned applications will result in the system repeatedly starting and killing processes, struggling with lags and huge battery drain.

    - SOURCE

    The command for zipaligning is...

    Code:
    [B]zipalign -v 4[/B] framework-res.apk ZAframework-res.apk

    ...notice the "ZA", again that can be anything you want so long as it differs from the original name, I use ZA for an obvious reason, and again don't forget to rename it before using on your Phone.

    66xncx.jpg



    Getting apks back to your Phone

    It's just a reversal of how you got them off your Phone to begin with, use a file explorer and put your apk on your SD Card, then move it to the Phones System folder and change it's permissions to rw-rw-r, then move and replace it with the original. Most apps should continue to work but if you change your framework-res or SystemUI you will most likely need to reboot. Or you can use adb to push and install them. Check the previous link for the commands.

    If all the above has worked correctly you should now have your modified apk installed with the changes you've made displayed on your Phone. :)

    66xncx.jpg



    Theming & Modifying

    This is where the fun begins, once you've got setup to decompile your apks then obviously you're going to want to mod them, so here's a few pointers to clear up what seems like a daunting process to new comers... :)

    To start with you'll probably just want to start with replacing images, so if that's all you want to do for now then here's a quick tip, you DON'T need to decompile or sign your apks!, simply edit and rename your replacment images on you computer, preferably using the same or similar dimensions then drag and drop them back into the right folders in the apk, always using Store as the compression method, but PLEASE NOTE; .9 pngs can be replaced in the same way, but if you want to edit them in Photoshop for example then you need DO need to decompile them.

    A few things to note...


    • Smali code is real Developer territory, it's Matrix code to me :p, thankfully there's usually a guide to follow so you can simply copy and paste code without having to fully understand how it works, so don't fret about this.

      .9pngs are simply png images with a 1 pixel border. You can edit anything within that border but anything on or over will give errors when building. Unless you're creating an image from scratch then you can leave the border as it is, it's that simple! Sure there's a bit more to .9png editing but you can find a few links below that go into more detail about .9s and how they work.

      xmls are relatively simple and edited with Notepad++, much simpler to understand than smali and again, there's usually a guide to be found for most mods you may want to make yourself, but if you're feeling brave you can experiment with it when you have a basic understanding of how it works.

      Restoring modified files if you mess up is easier and quicker with a CWM.zip, especially if you're modifying any framework apks! Just because an apk might build with no errors doesn't mean it won't give you any when installed to the Phone.
    66xncx.jpg



    .9png Editing

    I hope after reading this explanation you're left wondering what all the fuss is about, as it really is quite simple. :) I'll use the following two images, btn_default_pressed_holo.9 & status_bar_close_off.9 to illustrate the basic point of the borders...

    Decompiled .9pngs:

    2ivffib.png
    m91yz6.png

    Recompiled .9pngs:

    34owzyq.png
    33ae238.jpg

    Those borders control which part of the image is stretched, and we'll use Draw 9-patch which is for editing the borders of decompiled .9pngs and lets you see how the image, when stretched, will be displayed on the Phone. Notice that the borders are different sizes, well that's because I only want/need a certain part of the image to stretch to get the desired look on the Phone.

    4tx8up.png

    ...in the image below the left side shows the stretched image and desired effect should look on the Phone and the right side shows how it would look if I had edited the borders incorrectly or used none at all...

    25aizyo.png

    You can get away by not using a border but you would need to edit your image to specific dimensions to accommodate for the stretching, for example it might look fine for a simple OK button but it might not look right if you used the same .9png for a screen press which stretches the whole length of the screen, so you're better off just using them to begin with, plus you'll more than likely get errors down the line while decompiling or recompiling your apk.

    The use of the border is made even more clear when you add text to an image. For my status_bar_close_off.9 I've filled all four sides of the image (except for an empty pixel in all four corners as that is the max amount of border you can use) as I need it to stretch the image just how I've edited it...

    o0ym13.png

    ...but if I used the same sized left side border as the btn_default_pressed_holo.9 then this is how it would look on the Phone...

    2m639kz.png

    ...which is obviously not the look I'm trying to achieve, as the left side border is causing the image to stretch incorrectly.

    So that's basically it, depending on the image you're editing you can usually leave the borders alone but if you create one from scratch then you might need to play about with them if your images doesn't look quite right when used on the Phone. Here's a few links that will assist you further, especially the batch editing...



    66xncx.jpg



    Xposed Framework

    In this thread, I'm presenting a framework which gives you the possibility to modify your ROM - without modifying any APK (developers) or flashing (users)! :)
    ...
    Advantages:
    • No need to modify any APKs. This means:
    • No need to decompile, change things in smali, compile, sign, ...
    • It will work for odexed and deodexed ROMs.
    • Your mod is not bound to a specific version of the ROM. Unless there is a major change in the methods called for a certain functionality, your mod will continue to work even when you upgrade your ROM. Hell, it will probably even work with different ROMs.
    • Multiple mods can be installed at the same time, even if they change the same package. So you can use these battery icons and those quick toggles. Even hooking the same method twice is possible. Of course, this only works properly if the mods are not trying to do incompatible things.
    • It does its magic at runtime. That means you can implement options to let the user decide if they prefer the bikeshed to be painted in red or blue. Or you can have some extra logic for certain ROMs without building different mod versions.
    • It can be disabled easily without having to reflash.
    • It's open source.
    Screenshot_2012-04-05-19-32-42.png

    - [FRAMEWORK ONLY!] Xposed - ROM modding without modifying APKs


    66xncx.jpg



    CyanogenMod Theme Chooser

    CM10.1-THEME_BOOK

    Theme book was created by Annex and Ebs512. I've been asked alot of questions from how to get started? what do I need to get started? to What Graphics program do I use? etc. We made a real simple theme guide to help get you started. This is in Layman Terms.. Nothing fancy.

    ONLY THING FANCY IS MY FLASH BOOK :D
    YOU MUST HAVE A FLASH PLAYER INSTALLED TO VIEW THIS!!!

    av0s2r.png

    - [GUIDE] HOW TO THEME CM10.1 - Animated Book


    See a few post below for more...
    5
    thank you for your guide good job..
    But if u let me I can share the easier decompiling/recompiling without spending time to sign etc ..

    For System Apks..

    1-u can use apk manager.. (I still use wanam's ICS akp manager for ICS.. It works %100 for ICS and GB..)

    2- lots of people have problems while recompiling apk's especially on SystemUI.apk.. classes.dex file is the problem.. ıf you wont edit any smali files just 'open archive' apk with 7zip and dragg&drop classes.dex to folder and delete inside the apk. Decompile edit xmls and recompile it.. Right click to 2apks one by one (original and unsigned one) and 'open archive' with 7zip and drag&drop changed xmls to original apk and resources.arsc if u changed any xml from Values folder.. Finally put classes.dex back to original apk.. All ok!
    -While decompiling check the log file. Coz if u use .9.png files, it may occur problems and u can drag&drop to folder first with classes.dex.. and finally put they back together.. %100 works..

    3- Framework-res.apk
    ıt doesnt have classes.dex so u dont need to drag&drop anything.. decompile it and edit your xmls and recompile it.. Signing is same way as above.. drag&drop changed xmls from unsigned to original file. If u didnt change any xmls from values folders, you dont need to copy resources.arsc from unsigned to original apk..

    4- Other system apks like uxpnxtlockscreen.apk Settings.apk etc..
    Just decompile, edit, recompile.. Change name unsignedSettings.apk to Settings.apk.. It works..

    there are a lot of topics about using apktool editing xmls but when I need help noone helped me. I finally succeeded it by myself. Hope it will be helpful for you..

    Regards.
    2
    When I select zipalign all...
    It says no working folder found...
    what does it mean...?
    You haven't set up the folder. http://xdaforums.com/showpost.php?p=5626300&postcount=3
    2
    thank you for your guide good job..
    But if u let me I can share the easier decompiling/recompiling without spending time to sign etc ..

    For System Apks..

    1-u can use apk manager.. (I still use wanam's ICS akp manager for ICS.. It works %100 for ICS and GB..)

    2- lots of people have problems while recompiling apk's especially on SystemUI.apk.. classes.dex file is the problem.. ıf you wont edit any smali files just 'open archive' apk with 7zip and dragg&drop classes.dex to folder and delete inside the apk. Decompile edit xmls and recompile it.. Right click to 2apks one by one (original and unsigned one) and 'open archive' with 7zip and drag&drop changed xmls to original apk and resources.arsc if u changed any xml from Values folder.. Finally put classes.dex back to original apk.. All ok!
    -While decompiling check the log file. Coz if u use .9.png files, it may occur problems and u can drag&drop to folder first with classes.dex.. and finally put they back together.. %100 works..

    3- Framework-res.apk
    ıt doesnt have classes.dex so u dont need to drag&drop anything.. decompile it and edit your xmls and recompile it.. Signing is same way as above.. drag&drop changed xmls from unsigned to original file. If u didnt change any xmls from values folders, you dont need to copy resources.arsc from unsigned to original apk..

    4- Other system apks like uxpnxtlockscreen.apk Settings.apk etc..
    Just decompile, edit, recompile.. Change name unsignedSettings.apk to Settings.apk.. It works..

    there are a lot of topics about using apktool editing xmls but when I need help noone helped me. I finally succeeded it by myself. Hope it will be helpful for you..

    Regards.
    Thanks for the input. There are many different ways of doing things I guess. :)
    1
    can you help me with that?
    Sure, but need to know the errors first?