Android APK decompilation (see figure ).

Source: Internet
Author: User

During this time, I was learning about Android Application Development. I was thinking that since it was developed in Java, it should be a good decompilation to get the source code. Google is actually very simple. The following is my practical process.

I solemnly declare that the purpose of the post is not to crack the software of other people, but it is completely a learning attitude, but it seems that some foreign software can be customized in this way.


Note:This android decompilation tutorial, In the Windows7-Ultimate-64bit operating system, the test passed!

Download the decompilation Toolkit as follows

1. decompile APK to get the Java source code
First download two tools: dex2jar and JD-GUI

The former dex2jar is to convert the classes. Dex in the APK into a jar file, while the JD-GUI is a decompilation tool that can directly view the source code of the jar package. The following are:

Dex2jar:Http://laichao.googlecode.com/files/dex2jar-0.0.7-SNAPSHOT.zip

JD-GUI:Http://laichao.googlecode.com/files/jdgui.zip

Procedure:

First, change the suffix of the APK file to zip, decompress it, and obtain the classes. Dex, which is compiled by the Java file and then packaged by the DX tool;

Decompress the downloaded dex2jar and copy classes. Dex to the directory where dex2jar. bat is located. Locate the directory of dex2jar. bat under the command line.

Run

Dex2jar. Bat classes. Dex

Generate

Classes. Dex. dex2jar. Jar

The jar file is generated as follows:

 

Run jd-gui(jd-gui.exe) and open the jar package generated above. The source code is displayed.

Helloandroid source code(The source code of the APK before compilation is as follows:

 


Ii. decompile the source code and images, xml configuration, language resources, and other files of the APK Generation Program

This is especially useful for Chinese software. First, download the tool. This time, apktool is used.

: Http://code.google.com/p/android-apktool/downloads/list

Download: apktool1.4.1.tar.bz2 and apktool-install-windows-r04-brut1.tar.bz2 (both packages are downloaded)


Procedure:

Decompress the downloaded two packages to the same folder. There should be three files: aapt.exe, apktool. bat, and apktool. jar.

Locate the apktool. Bat folder in the command line and enter the following command: apktool d c: \ *. APK c: \ * folder, for example:

 

Command Line explanation: apktool d [APK file] [Output Folder]

The decompiled file is as follows (androidmanifest. XML is used as an example ):

Note: files to be decompiled must be placed in the root directory of drive C (in fact, they do not need to be placed in the root directory of drive C)

For example, in the D Drive Directory D: \ apktool1.4.1

CD/d: \ apktool1.4.1 // switch to the d directory, which contains three files: helloandroid.apkand aapt.exe, apktool. bat, and apktool. jar.

Apktool. Bat D-F helloandroid.apk helloandroid // apktool decompilation command. Note the writing of D and-f.

Re-package the decompiled file into an APK. You can simply enter the apktool B c: \ *** folder (the folder you compiled). The command is as follows:

 

The package APK file is in the directory c: \ helloandroid and two folders are generated:

Build

Dist

In this example, package the generated helloandroid.apk. In the above Dist folder, OK

LastNext, we will introduce the decompilation tool androidfby, which is a graphical interface tool that encapsulates the above steps,

During this time, I was learning about Android Application Development. I was thinking that since it was developed in Java, it should be a good decompilation to get the source code. Google is actually very simple. The following is my practical process.

I solemnly declare that the purpose of the post is not to crack the software of other people, but it is completely a learning attitude, but it seems that some foreign software can be customized in this way.


Note:This android decompilation tutorial, In the Windows7-Ultimate-64bit operating system, the test passed!

Download the decompilation Toolkit as follows

1. decompile APK to get the Java source code
First download two tools: dex2jar and JD-GUI

The former dex2jar is to convert the classes. Dex in the APK into a jar file, while the JD-GUI is a decompilation tool that can directly view the source code of the jar package. The following are:

Dex2jar:Http://laichao.googlecode.com/files/dex2jar-0.0.7-SNAPSHOT.zip

JD-GUI:Http://laichao.googlecode.com/files/jdgui.zip

Procedure:

First, change the suffix of the APK file to zip, decompress it, and obtain the classes. Dex, which is compiled by the Java file and then packaged by the DX tool;

Decompress the downloaded dex2jar and copy classes. Dex to the directory where dex2jar. bat is located. Locate the directory of dex2jar. bat under the command line.

Run

Dex2jar. Bat classes. Dex

Generate

Classes. Dex. dex2jar. Jar

The jar file is generated as follows:

 

Run jd-gui(jd-gui.exe) and open the jar package generated above. The source code is displayed.

Helloandroid source code(The source code of the APK before compilation is as follows:

 


Ii. decompile the source code and images, xml configuration, language resources, and other files of the APK Generation Program

This is especially useful for Chinese software. First, download the tool. This time, apktool is used.

: Http://code.google.com/p/android-apktool/downloads/list

Download: apktool1.4.1.tar.bz2 and apktool-install-windows-r04-brut1.tar.bz2 (both packages are downloaded)


Procedure:

Decompress the downloaded two packages to the same folder. There should be three files: aapt.exe, apktool. bat, and apktool. jar.

Locate the apktool. Bat folder in the command line and enter the following command: apktool d c: \ *. APK c: \ * folder, for example:

 

Command Line explanation: apktool d [APK file] [Output Folder]

The decompiled file is as follows (androidmanifest. XML is used as an example ):

Note: files to be decompiled must be placed in the root directory of drive C (in fact, they do not need to be placed in the root directory of drive C)

For example, in the D Drive Directory D: \ apktool1.4.1

CD/d: \ apktool1.4.1 // switch to the d directory, which contains three files: helloandroid.apkand aapt.exe, apktool. bat, and apktool. jar.

Apktool. Bat D-F helloandroid.apk helloandroid // apktool decompilation command. Note the writing of D and-f.

Re-package the decompiled file into an APK. You can simply enter the apktool B c: \ *** folder (the folder you compiled). The command is as follows:

 

The package APK file is in the directory c: \ helloandroid and two folders are generated:

Build

Dist

In this example, package the generated helloandroid.apk. In the above Dist folder, OK

LastNext, we will introduce the decompilation tool androidfby, which is a graphical interface tool that encapsulates the above steps,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.