The flower fades and the red and green apricots are small. When swallows fly, green water surrounds others.

Record the process of decompiling an Android app

Software Skills Birds on the 15th floor 88035 Browse 0 Comments

Work needs to pull out an app content, which mainly involves the core algorithm. There is no way but to decompile. Part of the content also comes from network This document is only for record.

Tools to be prepared for decompilation:

1.apktool:aapt.exe,apktool.bat,apktool.jar; The three are used together in the same directory to decompile and repackage the apk;

2. dex2jar: This tool is used to decompile the classs.dex file to the source code (if the apk is not consolidated), decompile the file, and use the jd gui tool to view it;

3. Auto Sign: an automatic signature tool that signs the repackaged apk. If it is not signed, it cannot be installed and used.

4. jd gui: This tool can directly view the contents of jar files without further unpacking. If the other app doesn't have a deep routine, you don't need to package it to view it.

Directly speaking, the process of unpacking, modifying and repackaging:

1. View content unpacking

 dex2jar.bat   classes.dex

This command comes from the dex2jar tool. The following dex file is obtained by directly renaming the apk file to zip and decompressing it.

After running, a classs_dex2jar.jar file will be generated in the tool directory

Open jd-gui.exe in the jd-gui folder of the tool. Open the generated classs_dex2jar.jar file with the tool, and you can see the source code. If it is not encrypted, this part of the content is readable.

 Record the process of decompiling an Android app Software Skills Page 1

2. To modify the source code, you need to use apktools to decompile and unpack.

 apktool.bat d -f test.apk -o test

After decompiling, you will get the test folder. Open the test folder, which contains various decompiled files.

In the first step, the file seen by the jd gui corresponds to the smali folder, and then find the corresponding address smali file

For example: smali com danfos koolapp a.smali corresponds to the content in the following figure

 Record the process of decompiling an Android app Software Skills Page 2

3. Modify source code

It is difficult to modify smali directly. smali is equivalent to compiled language. Although its readability is better than binary, it is still troublesome.

At this time, you need to install android studio. The download address is: http://www.android-studio.org/

Install after installation plug-in unit : java2smali, download address: https://plugins.jetbrains.com/plugin/7385-java2smali

After the plug-in imports the IDE, restart the IDE and create an empty Project. Copy the java content viewed in the jd gui, and select the IDE top menu: build -- Compile to Smali to compile from java to smali.

 Record the process of decompiling an Android app Software Skills Page 3

At this point, you can modify the java content according to your own needs and debug the output.

4. Repackage

You need to use the aoktool command to package again

 apktool.bat b test

 Recording the process of decompiling an Android app Software Skills Page 4

The obtained test.apk file needs to be signed

Copy test.apk to the folder of autosign tool

 java -jar signapk.jar testkey.x509.pem testkey.pk8 test.apk test_signed.apk

Then you will get a test_signed.apk file, which can be installed directly.

 Record the process of decompiling an Android app Software Skills Page 5

Finally, let's talk about the problem of Android virtual machine

Using virtual machine can make debugging more convenient and fast, without having to look at the phone repeatedly.

Using BlueStacks, this software has relatively fast response speed. You can obtain root permission in Settings -- Engine Settings. Use the re file manager to access the resources of the system folder. The shared folder path is: X: BluebacksCN Engine ProgramData Engine UserData SharedFolder


The tutorial is complete.



Please specify: Bird Blog » Record the process of decompiling an Android app

 tourist
Post my comments Change your identity
Cancel comment

Hi, you need to fill in your nickname and email!

  • Nickname (required)
  • Email (required)
  • website