To achieve code obfuscation, the method is as follows:
Because both my SDK and adt00000.1 are up-to-date, I have read the proguard. cfg obfuscation code method provided on the Internet,
. It is said that proguard. cfg will be automatically generated under the project file, but I cannot generate it, so I cannot use this method, which is a headache.
But today at the time of reading, found in fact under the project file, automatically generated the file: proguard-project.txt, project. properties two files, so is to open these two files, in proguard-project.txt has:
By default, the flags in this file are appended to flags specified
# In $ {SDK. dir}/tools/proguard/proguard-android.txt
If you open the proguard-android.txt file, it is found that the content is similar to the progurad. cfg mentioned above, and the estimation function is the same.
In the file project. properties, there are:
To enable proguard to shrink and obfuscate your code, uncomment this (available properties: SDK. dir, user. Home ):
# Proguard. config =$ {SDK. dir}/tools/proguard/proguard-android.txt: proguard-project.txt
Obviously, to use proguard to confuse code, you just need to restore this annotation. # proguard. config =$ {SDK. dir}/tools/proguard/proguard-android.txt: proguard-project.txt.
But it cannot just restore the comments. After I try it, I only need to put this sentence proguard. config =$ {SDK. dir}/tools/proguard/proguard-android.txt: The proguard-project.txt is placed after target = Android-10 to generate the APK.
Next, decompile the exported APK as follows:
In the generated JAR file, all the class names and variable names are changed to A, B, C, and other names that cannot be correctly understood, achieving the expected results.