Tuesday 8 November 2011

Using APKTool to Decompile and Recompile Android APKs

APKTool is an application which decompiles and recompiles android APKs.

It is very useful for decrypting the XML files inside the Android APK. After Decompilation we can edit the XML files and rebuild the APK. Since the strings used in the app are stored in the XML file (such as strings.XML) we can build a language pack  by translating the strings inside .XML file to any language we want.

This tool also allows us to debug the smali code.

Following is the step by step tutorial for using the APKtool on Windows.

1.Download the APKTool from http://code.google.com/p/android-apktool/.

2.Extract the downloaded APKtool to a directory (consider the dir name as apktoolwin).

3.Copy your apk file(consider the file name as xyz.apk) in the same directory.

4.Open command prompt and navigate to the APKTool directory (in our case apktoolwin).

5.Execute the following command
apktool d xyz.apk
Command prompt shows the following information
I: Baksmaling...
I: Loading resource table...
I: Decoding resources...
I: Loading resource table from file: C:\Users\sam\apktool\framework\1.apk
I: Copying assets and libs...

6.After successful completion you can find the directory with the same name as the apk file (in our case you will notice that xyz directory is been created in apktoolwin directory)

7.Now this xyz directory contains all the resources like images, xmls, etc which we can edit.

8.Use Notpad++ application for editing the xml files.

9.After editing the files we are ready to rebuild the apk. Use the following command to rebuild the apk
apktool b [folder name] [new file-name]

In our case

apktool b xyz  xyznew.apk

10.Done.You will find xyznew.apk is created in the apktoolwin directory.

No comments:

Post a Comment

About Us | Site Map | Privacy Policy | Contact Us | Blog Design | 2007 Company Name