[Reprinted] view the APK file and Reverse Engineering

Source: Internet
Author: User
First, let's talk about the APK structure. APK is compressed in ZIP format, which can be easily decompressed.

The structure of an APK file is:

The META-INF \ JAR file is often seen

Res \ directory for storing resource files

Androidmanifest. xmlProgramGlobal configuration file

Classes. Dex Dalvik bytecode

Resources. ARSC compiled binary resource file

The text file in APK is binary.

If we only want to view the manifest information of the APK. You can use the aapt command.

The naming format is:

Aapt dump badging *. APK (here *. APK is your APK name)

The aapt command can be found in the tools folder of the corresponding SDK version:

This is my path: C: \ Android-SDK-Windows \ platforms \ Android-7 \ tools

For files in the res directory, you need to use tools to read and generate text files. axmlprinter2 of android4me is a good choice.

:

Http://code.google.com/p/android4me/downloads/detail? Name = axmlprinter2.jar & can = 2 & Q =

Usage:

Java-jar axmlprinter2.jar capture. xml> test. xml

After the command is executed, the standard output capture. XML is written to the test. xml file.

Next let's start decompilation.Code. Decompilation code requires two tools:

    • Dex2jar, used to convert Dex files to jar files;
    • JD-Gui: reverse engineer the JAR file into Java code.

Dex2jar address: http://code.google.com/p/dex2jar/

Decompress the package and run the dex2jar command:

Dex2jar. Sh classes. Dex

After the command is executed, a file named classes. Dex. dex2jar. jar is generated in this folder.

JD-Gui is divided into three versions: Windows, Mac, and Linux. Download the corresponding version.

Address of JD-Gui: http://java.decompiler.free.fr /? Q = jdgui

Download and decompress the package. Click the execution file. Drag the JAR file generated by dex2jar into the jd_gui to generateSource code.

How to export programs installed on your mobile phone:

copy the APK file to sdcard. The command order is as follows:
* Go To The Android SDK Folder/tools directory
* enter ADB shell
* enter su
* enter CD Data
* enter the CD app
now you can see all the APK files you have installed. Enter the APK space/sdcard/
corresponding to the CP space to copy the APK file.
change the suffix of the APK file to the RAR format. You can see the familiar directory structure.

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.