This article explains the code obfuscation of Android Studio:
The first step: to make the confusion effective, to modify the project (APP) under the Build.gradle of a content:minifyenabled value is set to True, the current project can be used confused.
Apply plugin: ' Com.android.application 'Android {compilesdkversion24buildtoolsversion"24.0.0"Defaultconfig {ApplicationID"Com.aimqq.andfixdemo"minsdkversion15targetsdkversion24Versioncode1Versionname"1.0"Testinstrumentationrunner"Android.support.test.runner.AndroidJUnitRunner"} buildtypes {release {minifyenabledtrue//set here to true to indicate the use of confusion false means to disable confusionproguardfiles Getdefaultproguardfile (' Proguard-android.txt '), ' Proguard-rules.pro '}}}dependencies {compile Filetree (dir:' Libs ', include: [' *.jar ']) Androidtestcompile (' com.android.support.test.espresso:espresso-core:2.2.2 ', {Exclude group:' Com.android.support ', module: ' Support-annotations '}) Compile' com.android.support:appcompat-v7:24.1.1 'Testcompile' junit:junit:4.12 'Compile' Com.alipay.euler:andfix:[email protected] '}
Step two: Define our own obfuscation rules:
① let the obfuscation rule take effect only in the current project, we just need to add the rule to the project's Proguard-rules.pro file.
② If you want to be your own definition of the obfuscation rules after all the projects are in effect, then you need to go to your SDK directory under \tools\proguard\proguard-android.txt to modify, add the corresponding obfuscation rules.
If you want to know more about the confusion and grammar, please refer to this blog:
http://blog.csdn.net/u011889786/article/details/50945693
Android Studio Obfuscation