An introduction to the Android Anti-compilation tool and a simple and practical approach

Source: Internet
Author: User
Tags java decompiler

An introduction to the Android Anti-compilation tool and a simple and practical approach

The purpose of Android anti-compilation is simply to see the APK's XML, Resources and code:

How to get the code: Extract the APK file directly--get Classes.dex file--and use Dex2jar classes.dex Classes.jar generate Jar file--[optional extract jar file]-- View source code using Xjad or Jdcompiler

How to get the xml:

Mode 1: Unzip the APK file directly--and view the XML file with the Axmlprinter tool (this way the ID of the XML file is a number-the value corresponding to the ID in the R file)

Method 2: Unzip the apk file using the Apktool tool to view the XML file directly

Android Anti-compilation often uses some of the following tools:

1. Anti-compile command:

Apktool D d:\\developer\androiddecode\test0201.apk d:\\developer\androiddecode\test0201

D:\\DEVELOPER\ANDROIDDECODE\TEST0201.APK: apk file to Decompile

d:\\developer\androiddecode\test0201: The Save directory for the anti-compilation file must be an empty directory

2, compiled from the anti-compilation file apk apktool b d:\\developer\androiddecode\test0201 d:\\developer\androiddecode\test020101.apk

D:\\DEVELOPER\ANDROIDDECODE\TEST0201: Save the compiled file directory

D:\\DEVELOPER\ANDROIDDECODE\TEST020101.APK: The absolute path to save the generated new APK file

3. Signature APK file:

Singedapk.bat file

Java-jar "%~dp0signapk.jar" "%~dp0testkey.x509.pem" "%~dp0testkey.pk8"%1 signed.apk

Execute Singedapk.bat command

singedapk d:\\developer\androiddecode\test020101.apk generate a singed.apk file and test020101.apk in the same directory

4. Use Baksmali.jar to convert a Dex file to a Smali file

Java-jar D:\\developer\apktool\baksmali.jar-o d:\\developer\androiddecode\baksmaliout D:\\Developer\androidDecode \hello.dex

Full path to the D:\\developer\apktool\baksmali.jar:baksmali.jar file

D:\\developer\androiddecode\baksmaliout: Save directory for generated Smali files

D:\\developer\androiddecode\hello.dex: The path to be converted to the Smali file

5. Use Ddx.jar to convert a Dex file to a DDX file

Java-jar d:\\developer\apktool\ddx.jar-d d:\\developer\androiddecode\ddxout D:\\developer\androiddecode\hello.dex

Absolute path to the D:\\developer\apktool\ddx.jar:ddx.jar file

D:\\developer\androiddecode\ddxout: Path to save the DDX file

D:\\developer\androiddecode\hello.dex: The Dex path to convert

6. Android comes with Dexdump tool: Dex file to Smali file dexdump-d xxxx.dex > Xxxx.smali

7, Dex2jar.jar:dex2jar Xxx.dex Yyy.jar

Description

Apktool Project Address: https://code.google.com/p/android-apktool/

Baksmali Project Address: https://code.google.com/p/smali/

Dex2jar Project Address: https://code.google.com/p/dex2jar/downloads/list

Java Decompiler (JD) Project address: http://jd.benow.ca/

Xjad Baidu Network disk: http://pan.baidu.com/share/link?shareid=406366626&uk=3558809438&fid=881236853

Axmlprinter Project Address: https://code.google.com/p/android4me/downloads/detail?name=AXMLPrinter2.jar&can=2&q=

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.