[Android]apk Anti-compilation method

Source: Internet
Author: User

In the process of learning Android development you, you tend to want to learn how other people's apk is developed, as a developer, you may want to know how these effects interface is implemented, then you can change the application of the APK for anti-compilation view. Here is a brief tutorial on some of the articles I've consulted.

Tool Description:

Apktool

Function: Resource file gets, can extract picture file and layout file for use view

Dex2jar

Role: Decompile the apk into Java source code (Classes.dex into a jar file)

Jd-gui

Role: View the apk in the Classes.dex converted into a jar file, namely the source file

Anti-compilation process:

First, APK anti-compilation to get The program's source code, pictures, XML configuration, language resources and other files

Download the Apktool in the above tool, extract the 3 files: Aapt.exe,apktool.bat,apktool.jar, will need to put the anti-compilation apk file in this directory,

Open the Command line interface (run-cmd) , navigate to the Apktool folder, and enter the following command:apktool.bat d-f test.apk test


(test.apk in the command refers to the full name of the APK file to be deserialized, and test is the directory name that is stored in the post-compilation resource file, i.e.: Apktool.bat d-f [apk file] [output folder])

After the description is successful, you find that you have more than one test file under the folder and click to view all the resource files for that app.

Second, APK anti-compilation to get Java source code

Download the Dex2jar and Jd-gui in the tools above , unzip

To decompile the APK suffix name to. rar or. zip, and unzip, get the amount of the Classes.dex file (it is the Java file compiled and then packaged by the DX tool), will get to the Classes.dex put it in the dex2jar-0.0.9.15 folder of the tool that was extracted before,

Under the command line to locate the Dex2jar.bat directory, enter Dex2jar.bat Classes.dex, the effect is as follows:

A Classes_dex2jar.jar file is generated under the directory , and then the Jd-gui.exe in the tool Jd-gui folder is opened, and then the Classes_ that was generated before the tool is opened. Dex2jar.jar file, you can see the source code, the effect is as follows:

[Android]apk Anti-compilation method

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.