Decompile Android APK to obtain Java source code and resource files

Source: Internet
Author: User

During this time, I was learning about Android Application Development. I was thinking that since Java was used for development, it should be a good decompilation to get the source code. Google is actually very simple. Here is my practice 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.

1. decompile APK to get the Java source code

First download two tools: dex2jar and JD-GUI, the former is to convert the APK classes. Dex into a jar file, while the JD-GUI is a decompilation tool, you 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:
  1. 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;
  2. Decompress the downloaded dex2jar and copy classes. Dex to the directory where dex2jar. bat is located. Locate the directory of dex2jar. bat in the command line and run
    dex2jar.bat classes.dex

    Generate classes. Dex. dex2jar. Jar

  3. Run the JD-GUI, open the jar package generated above, you can see the source code.
Ii. decompile the source code and images, xml configuration, language resources, and other files of the APK Generation Program

This is especially useful if it is just a Chinese software. First, download the tool. This time we use apktool ,:

Bytes.

Procedure:
  1. Decompress the downloaded two packages to the same folder. There should be three files: aapt.exe, apktool. bat, and apktool. jar;
  2. Go to the apktool. Bat folder under the command line and enter the following command:
    Apktool d c: \ ***. APK c: \ *** folder

    Command Line explanation: apktool d [the APK file to be decompiled] [Output Folder]. Note: The files to be decompiled must be placed in the root directory of drive C;

  3. Re-package the decompiled file into an APK. It is easy to enter the apktool B c: \ *** folder (you can compile the folder.
Article transferred from:

Http://www.maxhis.info/androiding/android-apk-decompile/

Related Article

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.