Please respect other people's labor results, reproduced please specify the Source: "Android Code obfuscation Guide"
This article will share with you the ways to use Eclipse+adt to obfuscate your code with Android studio.
How to use Eclipse+adt for code obfuscation and packaging Packaging obfuscation under the new version SDK if you create an Android project with the new version of the SDK, a proguard-project.txt file is generated at the root of the project, which is the default obfuscation rule file. To confuse Packaging: 1. Add a confusing project rule to the Proguard-project.txt file, and you can refer to the "confusion rules for confusing Android code" article. 2. Add the #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt in the Project.Properties file: Proguard-project.txt before the # number to go. For example, the configuration for obfuscation has been completed. 3. Package the project, then: Right-click on the project "Export" Select Export android Application "Next" Select the Android Project key (no words can create a) "finish." At this point, the project has been confused packaging completed, if not at ease, you can use the "Android development Anti-compilation and anti-compilation" in the article described in the method of the test after the confusion of the code. Note: It is not confusing to run a program-generated installation package directly. Packaging obfuscation under the old SDK the project created under the old SDK does not generate a proguard-project.txt file but a proguard.cfg file. To confuse Packaging: 1. Add a confusing project rule to the Proguard.cfg file, and you can refer to the "confusion rules for confusing Android code" article. 2. Add proguard.config=proguard.cfg to the Project.Properties file. Example: 3. The remaining steps are consistent with the method of packaging under the new version of the SDK. How to use Android studio for code obfuscation and packaging
Projects created using Android Studio generate a Proguard-rules.pro file in the root of the project, which is a confusing rule file.
To obfuscate the packaging steps:
1. In the Proguard-rules.pro file, add the confusing project rules, you can refer to: "The confusion rules of the Android code confusion" article.
2. Change minifyenabled false to minifyenabled true in the Build.gradle file under module.
Such as:
Buildtypes { Release { minifyenabled true proguardfiles getdefaultproguardfile (' Proguard-android.txt ') , ' Proguard-rules.pro ' } }
Where: Proguardfiles getdefaultproguardfile (' proguard-android.txt ') means to get the default obfuscation rules in the ' proguard-android.txt ' file under the SDK.
' Proguard-rules.pro ' means using the obfuscation rules in the ' Proguard-rules.pro ' file under the project root directory.
Hint: The Proguard-rules.pro file name can be arbitrary, as long as it is indicated in the configuration file. For example, to copy a proguard.cfg obfuscation rule file from another project, simply change the above code to Proguardfiles getdefaultproguardfile (' proguard-android.txt '), ' Proguard.cfg ', this sentence means using the Proguard.cfg file in the project's root directory as the obfuscation rule file for this project.
3. Package your project and package it using the Generate signed APK under the Build menu. Note, remember to select release under the Build Type: option, otherwise packaging is not confusing. Such as:
》》
Recommended reading: "Anti-compilation and anti-compilation of Android Development"
"Android Code obfuscation Skills"
"Go" Android Code obfuscation guide