Android decompilation and prevention of Decompilation

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.

 

 

In this document, the android decompilation tutorial and test environment are as follows:

Win7 ultimate x64

Ubuntu 12.04 x86_x64

Decompilation Toolkit Download(Updated on February 10)

 

I. APKDecompilationObtain the Java source code

Download the decompilation toolkit, open the dex2jar-0.0.9.9 folder under the apk2java directory, contains APK decompilation into Java source code tools, as well as source code viewing tools.

The APK decompilation tool dex2jar is used to convert the classes. Dex in the APK into a jar file.

Jdgui is a decompilation tool that allows you to directly view the decompilation jar package source code.

 

Dex2jar and jdgui are downloaded in the latest version. For details, see Google Code:

Dex2jar (Google Code)

For the latest version of jdgui (Google Code), see the official website

 

Procedure:

First, change the suffix of the APK file to zip and decompress it to obtain the classes. dex, which is compiled by a Java file and then packaged by the DX tool. copy Dex to dex2jar. the dex2jar-0.0.9.9 folder in the directory where BAT is located.

Locate the directory of dex2jar. bat in the command line and run

Dex2jar. Bat classes. Dex

Generate

Classes_dex2jar.jar

 

Then, double-click jd-gui.exe and open the jar package classes_dex2jar.jar generated above to view the source code, as shown in the following figure:

The following is a comparison of the helloandroid source code before and after decompilation:

 

 

 

Ii. APKDecompilationGenerate program source code and images, xml configuration, language resources, and other files

This is especially useful if it is a Chinese software.

First, download the decompilation toolkit mentioned above. For the latest apktool, download it from Google Code.

Apktool (Google Code)

 

Procedure:

Download the decompilation toolkit and open the apktool1.4.1 folder under the apk2java directory, which contains three files: aapt.exe, apktool. bat, and apktool. jar.

Note: apktool_bk.jar is the old backup version. It is best to use the latest apktool. Jar

 

Go to the apktool. Bat folder under the command line and enter the following command:Apktool. Bat D-F abc123.apk ABC123Such:

 

Apktool. Bat command line explanation: apktool. Bat D-f [APK file] [Output Folder]

 

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

 

Re-package decompiled files into APK, which is easy to inputApktool. Bat B ABC123(You can compile the folder). 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

 

 

Iii. Graphic decompilation APK

Steps 1 and 2 above describe the command line decompilation APK, and now provides a graphical decompilation tool: androidfby

First, download the decompilation tool package, open the androidfbydirectory, and double-click the androiddecompilation tool .exe to open the decompilation APK.

 

 

This document decompile the toolkit to sort out the previous versions:

Android decompilation Toolkit (upgrade)

Android decompilation tool)

Android decompilation tool)

 

 

This blog decompilation method is for reference only. It cannot be used for illegal or commercial purposes. Thank you!

 

 

Reference recommendations:

How does Android prevent the APK program from being decompiled?

This article from: http://blog.csdn.net/sunboy_2050/article/details/6727581

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.