[LEARN] modding apks the easy way!

pitchblack5691

Senior Member
Jan 12, 2012
437
447
0
chennai
Hi friends of XDA,

today, i present you a easy method (more like a idea) on how to learn about what is actually modified in a apk and help you to
get an idea about creating your own mod by understandig other mods.


first is first!


#include
/*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because of you following this guide.
* do some research if you have any concerns.
* YOU are choosing to make these modifications.
* you cannot point the finger at me for messing up your device.
* yes, i copied this disclaimer from FXP coz itz cool and i am lazy! :D
*/


okay now let´s get started,


things you need,

1. apktool
2. WinMerge (WinMerge is Open Source software under the GNU General Public License)
3. a modded apk and it's original untouched unmodded apk for your device.
4. A LOT OF PATIENCE (learning modding apks is not so easy).


step by step,

1) apktool part,

1.1) install framework-res.apk, SystemUI.apk, SemcGenericUxpRes.apk in apktool
.
NOTE: below, any apk can be used, i'm using SystemUI.apk as a example.

1.2) decompile and compile both the original SystemUI.apk pulled from your device and the SystemUI.apk from the mod
which you are going to learn what has been changed.

NOTE: step 1.2 is done to make sure that the apktool you are using is comaptible with your apks if it throws errors
while compiling and/or decompiling unmodified system apks then use a different version of apktool which works with your
device and version of android you are going to use (google it).

1.3) after succesfully installing required apks and testing the apktool, clean the apktool folder (remove decompiled apk folders and
remove unwanted apks from the folder).

1.4) copy the pulled original SystemUI.apk from device (or pull it again) to apktool folder and rename it to make you remember that it
is the original apk (i named it as SystemUI_ori.apk).

1.5) copy the modded SystemUI.apk from the mod and rename it to make you remember that it is the modded apk
(i named it as SystemUI_mod.apk).

1.6) decompile SystemUI_ori.apk and SystemUI_mod.apk.



2) winmerge part,

2.1) open winmerge

click open



2.2) you'll get the following window (select files and folders)



2.3) in the left and right path box type in your path to the decompiled original and modded apks directory.
as shown below and click ok (ok button will be only visible if you choose two valid directories)



2.4) now the two directories you selected will be opened and their similarities in files and
directories will be displayed in the comparison result column as shown below,



2.5) the comparision result column will display what type of file it is and whether they are different or identical as shown below,




2.5) if the file or directory is only present in one directory of the two selected directories (see 2.3) then the comparision result column
will show as highlited in the below image.



2.6) from 2.4 and 2.6 you can easily determine what files have been edited and/or added by the modder to achieve the corresponding
changes in the mod.


2.7) Now when you double click the file which is present in both the left and right directories, those files will be opened and their
differences will be highlighted.
for example let us open a text file (normally all files are text type in a decompiled apk except images) whose comparison result
show that they are different,
the text file in both left and right opens side by side and the lines which contains the differences will get highlighted in yellow,
the part of the line which is actually different from one another will be highlighted in light yellow as shown below.



NOTE: since the apk is decoded by apktool, the files will be always in human readable source form so just by looking at the differences in the
text we can get a clear picture on what is changed in the file and how does it impact in the final modded apk. If you yourself have a good
knowledge of xml and java it'll be a breeze for you to understand it! :)
you can also copy the whole changes of one file to another or just copy the changes line by line, to learn more about this see the further
reading part below.

3) PLEASE do not ask me about apktool errors or what to edit in a apk to get this etc., type of questions
i'm still in the nascent phase of learning about modifying apks and theming, i am using this method to learn so i am recommending this
to interested friends.

4) if you have doubts and/or errors in using apktool post here.


FURTHER READING:

5) I HAVE COVERED ONLY THE VERY BASICS OF LEARNING MODDING USING WinMerge.
to learn more about the shortcuts and functionalities of winmerge read winmerge quick guide and complete guide..


CREDITS:
authors of winmerge
authors of apktool

HAPPY LEARNING MODDING!

PLEASE PRESS THANKS IF THIS THREAD IS USEFUL!
 
Last edited:

ssanjay19

Senior Member
Jan 10, 2010
188
79
0
Chennai
Damn awesome tut bro!!
Was manually comparing both files inside apk to find which file has been modified..
U made it easier for me..

Cheers:fingers-crossed:
 

pitchblack5691

Senior Member
Jan 12, 2012
437
447
0
chennai
Apktool doesnt open on my pc. It just shows up for a sec and then disappears! :( :(
Install java first,

In win7 open the directory where you placed the apktool.jar , hold shift and right click inside the folder, in the menu click "open command window here" and in the command window type,

java -jar apktool.jar
In xp
Open command prompt change directory to the apktool.jar directory and type the above quoted.

Hit thanks if I helped you.

Sent from my ST15i using xda app-developers app
 
Last edited:
  • Like
Reactions: Inc8pable