An analysis of anti-compilation of Android

Source: Internet
Author: User

An analysis of Android anti-compilation

From the touch of Android development and Development, anti-compilation has always been inseparable from the tool, learning good Android application code writing specifications.

This article is mainly about how to decompile the APK file to get Java files, anti-compilation not to steal, only for learning the exchange code. The directory structure for this article is:

1. Overview

2. A detailed story about the APK project's anti-compilation

Overview:

Analysis of the directory structure of Android engineering can be known, it basically can be easily understood as three parts: source code, resource files and compiled configuration files. This resource file (image, XML file, assert, etc.) is stored directly in the APK from the beginning of packaging, picture, etc. without anti-compilation, source code (temporary access to Java source code) file is likely to be "confused" to prevent others to decompile, The confusing file is stored in the config file Ant.properties file, and the configuration file, mainly the Androidmanifest.xml file, is directly exposed, which is critical. Obtaining the XML File box source code becomes the most important task of anti-compilation.

The following is a detailed account of the APK project anti-compilation one, using the compilation tool

I am also directly from the Internet to download the Anti-compilation tool, the use of good results, here: http://download.csdn.net/detail/feishangbeijixing/8094335

1, Apktool, get the XML file

2. Android Anti-compilation tool

Ii. Commencement of work

A) Apk--> Project catalogue

This step is relatively simple, primarily to get androidmanifest.xml files, dex files, layout files, and resource files. There are two ways to achieve this:

1. Unzip the APK directly

In this case, the APK project without "confusing" can directly get the XML file (directly readable) and the Dex file; But the XML file in the "confusing" apk project file does not seem to be readable directly (garbled display)

2. Using Apktool Tools

How to use: First unzip the Apktool, in the APK folder directory to place the APK file needs to be unzipped and renamed to 123.APK. Double-click the Apktool file (which is actually a script file for Windows, which can be run in Dos), and then, after clicking on it, perform the decompile or back-compilation as shown.



b) dex--> Source code

There is a previous step to get the Dex file (in the previous step directly decompression may not get the Dex file, tried several times seems to be so)

Using the Dex2jar.bat tool in the Android Anti-compilation tool, Location: Android Anti-compilation tool Android anti-compile \dex2jar-0.0.9.15.

1, execute the command: Dex2jar.bat Classes.dex (before executing the command, you need to put the Classes.dex file into the dex2jar-0.0.9.15 folder, after executing the command can get Classes_dex2jar files)

2. Use the Jd-gui tool to view the Class-dex2jar package files obtained in the previous step. We can see the source.

3, anti-compilation can be viewed and modified without the "confusion" of the source. Then you can use the "your" apk app by compiling and signing the Apktool back and forth.

An analysis of anti-compilation of Android

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.