Wednesday, March 15, 2017

Decompile and Modify APKs on the go with APKTool for Android [XDA Spotlight]

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.

XDA-Developers does not condone using APKTool for any kind of application piracy. There are many reasons to use APKTool, but modifying an application for piracy purposes should not be one of them.


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

 

Follow the XDA Thread Contribute to the APKTool Project

 

Discuss APKTool on the Official Gitter Channel Discuss APKTool on the Official IRC Channel



from xda-developers http://ift.tt/2nFYinO
via IFTTT

No comments:

Post a Comment