Detailed explanation of Android decompilation and code confusion
preface
Include the following
To decompile APK, you need the following three tools
1. Apktool (resource file acquisition) function: resource file acquisition, which can extract picture files and layout files for use and viewing
2. Function of dex2jar (source file acquisition): decompile APK into Java source code (classes.dex into jar file)
3. JD GUI function: check the jar file converted from classes.dex in APK, that is, the source file
Decompile resource files and class files as follows:
Decompile resource file
Resource files: including picture resources, layout resources, animation, style and other resources
In this way, the resource files can be seen.
Decompile class file
Method 1: decompile the Java class
1. Download and unzip dex2jar-2.0 to get the dex2jar-2.0 folder, which contains dex2jar.bat and its files
2. Change the APK file to xx.zip file, extract the classes.dex file, and copy it to the dex2jar-2.0 folder
three
Generate a classes-dex2jar.jar file, and use jd-gui.exe to open the generated classes-dex2jar.jar file
Method 2: directly use the smali2java tool
What is SmalI? SmalI is a language that expresses Android bytecode in the form of readable string, which can be called the disassembly language of Android bytecode.
Code confusion
You can only confuse Java classes, not resource files. System defined components cannot be confused. Must be an exported APK.
How to implement code obfuscation
Confusion class file
Modify build.gradle under module: app
Add in proguard-rules.pro:
Put the following code at the end of proguard-rules.pro:
Sync and then package
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.