APKTool is a powerful piece of software developed by XDA Senior MemberĀ ibotpeaches. The tool allows you to reverse engineer APK files, allowing you to decode resource files so you can modify them and then recompile the application.
It is extremely difficult to qualify just how important this tool is to the Android community, but a list of some of its more popular use cases should give you a great idea why the tool and its developer are held in such high regard. APKTool is used to port applications to previously unsupported devices, theme some of your favorite applications, look into the strings of APK files to see what may be coming in future updates, and provide translations for applications. On the other hand, itĀ can also be used nefariously to hide and distribute malwareĀ or in the converse used for Android application penetration testing in Kali Linux.
APKTool has been available on Linux/GNU distributions and MicrosoftĀ Windows operating systems since initial release, but Android support for the tool has been missing for quite some time. Limited support for Android devices was available for a few months, but updates to the official Android version of the tool ceased in 2013, making it useless for reverse engineering any modern APK file. However, a developer by the name of Andro BlackĀ has been independently releasing updated versions of APKTool for Android, so you can decompile and modify APK files on the go with any rooted Android device.
APKTool for Android
The application itself is a little rough around the edges as it contains a few spelling mistakes and a rather buggy theme switcher, but honestly I could care less since there is no other tool on Android that can accomplish this functionality. Ā APKTool for Android does exactly what its big brother PC version does ā reverse engineer APK files. You can decompile and recompile applications straight on your phone, which can be useful if you want to quickly modify anĀ APKās resources without having to get in front of your desktop. This can be especially useful for themers who may find themselves constantly editing an APK file and sending it over to their device for live testing. Be warned though, the APKTool application cannot be used for actually editing the decompiled files, for that you need a text editor on your device.
The settings menu allows you to change the theme of the application as mentioned previously, but more importantly you can selectĀ the AAPT and APKtool versions that you want to use when decompiling an APK file. There is also a check mark for ārootā in the settings, without this checked you cannot compile applications properly (and itās not checked by default.)
To work with applications you have two menus, one is displayed on a short tap and the other is displayed on aĀ long press. The single tapĀ menu as shown below displays the functions you can use to work with an APK file, the main ones beingĀ Decompile All and Sign. There are a number of other functions here, but these shouldnāt be unfamiliar to you provided you have prior experience with APKTool.
After decompiling an APK, you can browse its contents by simply tapping on the folder with the APKās name to display its contents. Tapping a file will load the default Android behavior and ask which application you want to open the file with, whichĀ at this point you would use your chosen text or image editor if you are attempting to modify a resource.
Once you have finished tinkering with the APK you can install your modified version from inside the APKTool application as well.Ā The long press menu allows you to delete/rename files and folders, but itās also context aware so when you long press a folder you will get the option to compile all of the resources and smalis into an APK file again.
I found the tool quite useful for quick changes to an existing application as I was able to decompile an existing application, change the strings.xml file, and recompile the application again to view the changes. How fast the tool performs these actions, though, depends on your device. On my Google Nexus 6P, decompiling an APK file took around 2 minutes while re-compiling an APK took around another 2 minutes,Ā so I personally wouldnāt want to be using APKTool from my phone all that often.
Working with APK files on your phone is not the most straight forward process, but APKToolĀ tool makes it do-able. I wouldnāt recommend developers switch to exclusively modifying APKs on their Android phone given that itās both slow and more difficult to manage, but if you own an Android tablet and are looking for a more convenient way to make frequent small modifications and test them on a live device, then APKTool for Android is your best bet.
Resources
Install APKTool on your Rooted Android Device Install APKTool on your Linux/Windows Device
Contribute to the APKTool Project
Discuss APKTool on the Official Gitter Channel
Discuss APKTool on the Official IRC Channel