Alright. Due to popular demand, there is my tutorial on how to create your own modded APKs, game mods and game hacks using APK decompiling, editing/modifying and recompilation. – Be warned, if you want to make mods that are more than just visual, you will have to have engineer level knowledge of java and ideally other programming languages.
- Any old APK Decompile/Compile Tool
- Windows PC / Mac
- Ideally, you know Java on an Engineer level
What you are going to want to do is to get the APK of the game or app you want to mod, decompile it (unpack it into all the contained resources and scripts), then modify the scripts and resources and recompile the app. After that you go to testing and using of the hacked app.
Get the APK you want to mod
Getting the APK file can be done by simply downloading it off the internet or using a file manager to copy it from your apps directory on your Android device and putting it on the SD card to extract it. Should not be any kind of problem at all.
Decompile the APK
Decompiling and extracting of the java compiled scripts can be done using different tools and the ideal way of doing it changes every few months, but here is an in-depth guide on how to do it that I found of Stackoerverlfow and really, I could not put it into better words myself.
- Make a new folder and copy over the .apk file that you want to decode.
- Now rename the extension of this .apk file to .zip (e.g. rename from filename.apk to filename.zip) and save it. Now you can access the classes.dex files, etc. At this stage you are able to see drawables but not xml and java files, so continue.
- Now extract this .zip file in the same folder (or NEW FOLDER).
- Download dex2jarand extract it to the same folder (or NEW FOLDER).
- Move the classes.dex file into the dex2jar folder.
- Now open command prompt and change directory to that folder (or NEW FOLDER). Then write d2j-dex2jar classes.dex(for mac terminal or ubuntu write ./d2j-dex2jar.sh classes.dex) and press enter. You now have the classes.dex.dex2jar file in the same folder.
- Download java decompiler, double click on jd-gui, click on open file, and open classes.dex.dex2jar file from that folder: now you get class files.
- Save all of these class files (In jd-gui, click File -> Save All Sources) by src name. At this stage you get the java source but the .xml files are still unreadable, so continue.
Now open another new folder
- Put in the .apk file which you want to decode
- Download the latest version of apktool ANDapktool install window (both can be downloaded from the same link) and place them in the same folder
- Open a command window
- Now run command like apktool if framework-res.apkand next
- apktool d myApp.apk(where myApp.apk denotes the filename that you want to decode)
now you get a file folder in that folder and can easily read the apk's xml files.
It's not any step just copy contents of both folder(in this case both new folder)to the single one
If you are simply looking to modify very basic resources, templates, names ect, then you will not have to do any more than simply decompiling the APK file using any decompiler or .zip unpacking tool available on the internet.
Modify the Resources (Visual Hacks/Mods)
This is what most of the people reading this will be able to do and it entails navigating in your decompiled APK folder and editing some simple image and xml files:
First off, in the root folder of your decompiled app you can find the ‘manifest’ fie that defines the app name, permissions requested and other foundational definitions.
The ‘res’ or ‘resources’ folder, where you will find the very basic visual building blocks that the game / app is made of. The ‘minimap’ folders is where you can change start icons of the app, the drawable folder will include back grounds, you may also find other images, such as sprites, loading screens, game characters ect here in the case of games.
Images can be modded by simply opening them in any image editor or photoshop to edit them.
XML files are templates that structure screens, menus, that include formatting and sometimes text that can be modded as well.
Modify the Java Code
So far in 2018 it is not possible to get the exact source code out of an APK as far as I am aware. You will always get an inlined, compiled version that is different from the original source code no matter what tools you use.
While you need to be able to modify scripts if you want to create game hacks or game mods that actually do something, you will have to at the very least know Java in order to have any shot at success of implementing cheats into an Android Game APK.
For most of us, this is where the APK Modding journey ends. Java is extremely complex and reverse-engineering and reassembling Java code from a decompiled APK is beyond what 99% of the people that will read this article will ever be able to do. If you are one of the few that has enough experience and knows Java well enough and has the time and energy to do it, then go nuts.
Depending on the game/app, modifying the Java code can give you anything from unlimited possibilities, in terms of games we are talking god modes, unlimited gems, unlimited money ect. Is the app/game online based however, even modifying the code will not be able to give you too powerful cheats. However, we are still hoping for the emergence of Aimbots and Wallhacks on Android, which is certainly a possibility.
Recompile, Test and Enjoy
Good, you just modified your APK. It is now time to use your favorite APK decompiler/decompiler tool to recompile the APK, fire up any emulator and test the thing to see if the modifications you made sticked or if you have to go back in and work some more.
Tips for Beginners looking to create Modded APKs for Android Games
How can you modify something that you have never built? That is really what you have to ask yourself if you are looking to learn APK modding. - The best way to get started into modding Android games it to create Android games.
You will learn Java, how to create Games in Android Studio and using other tools to create game resources and make them work together. And frankly, if you don’t know how a game works, you will never be able to mod it successfully.
Also learn how to reassemble source code from APKs. Pretend to lose your source and then try to reassemble it, that will teach you a lot about reverse-engineering compiled Java and you having programmed the code will make it easier for you to reassemble it, since you understand all the functions and code involved.