Android decompiled code and prevent decompiling

  • 2020-06-23 01:58:42
  • OfStack

1. Decompile apk files

Install the ApkTool tool, which can decode the resource file but not the Java source file.
Installation environment: Es7EN1.6 needs to be installed

1 > To http: / / code. google. com/p/android apktool /

Download apktool1. 3.2 tar. bz2 and apktool - _r01 install - windows - 2.2-3. tar. bz2 file.
Unzip the two files, and then put the unzip file at 1, such as: c:\apktool

2 > Add aapt. exe to system variable PATH, such as:; c: \ apktool \ aapt exe

3 > Under the DOS window, go to the directory where apktool.jar is located.
Execute the DOS command: apktool ES57en-ES58en c:\soft\xxx.apk c:\soft\source.
Command format: apktool d [opts] < file.apk > d in [dir] represents decoding, [opts] represents options, and the -ES76en option represents not decoding the source file.

2. The Apktool tool can only be decomcompiled into the intermediate code file of smali. Here, another open source tool, Dex2Jar, is needed.

The tool converts dex files to jar files. This tool does not translate directly to java files, but can convert dex files to jar files

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

1 > Unzip classes.dex from the APK installation package to a directory such as c:\soft
2 > Under the DOS window into dex2jar. bat directory, execute DOS command: dex2jar. bat c: \ soft \ source \ classes dex c: \ soft \ source, command produces classes. dex. dex2jar. jar file.

3. Install the ES137en-ES138en tool, which decomloads the jar file into Java source file

Download address: http: / / java decompiler. free. fr/jd - gui downloads/jd - gui - 0.3.3. windows. zip.
Run the software, open classes directly. dex. dex2jar. jar see java source code file.

Conclusion:

apktool1. 4.1 tar. bz2 decompiler jar package
apktool install - windows - r04 - brut1. tar. bz2 windows with jar exe file execution

1. Unpack these two files and copy apktool. jar in apktool1.4.1 to the directory apktool-ES191en-windows-r04-brut1.

The red ones are apk files to be decompiled

cmd switch to this directory and execute:
> apktool ES204en-ES205en queryNumber.apk./source generates the source directory in the current directory, with the resource files underneath

2. Unzip dex2ES213en-0.0.7.11-ES214en.zip copy the directory and execute:
> dex2jar class.dex
Generate the classes_dex2ES224en.jar file

It's full of.class files

3. Open ES231en-ES232en.exe and drag classes_ES235en2ES236en.jar to the jd-ES239en interface
You can see all the source files at this point:

How to prevent decompilation...

Since apk is loaded by the Android virtual machine, it has a specified specification. Dalvik cannot recognize apk after encrypting apk.
It's impossible to avoid it completely. Someone will always be able to crack your code. But there are several ways to make decompiled code more difficult.

Key code USES jni to call native code, written in c or c++, so it is relatively difficult to decomheap

Confuse the java code. Obfuscation is adding useless code without changing the code logic, or renaming it to make the decompiled source hard to understand.
java code on the web open source confusion tool more, 1 is generally used ant way to compile

This is the end of this article, I hope you enjoy it.


Related articles: