Enable ProGuard for your build
suggest changeTo enable ProGuard for your application, set minifyEnabled to true in the module-level Gradle file.
shrinkResources true removes resources the shrinker marks as unused. Shrinking resources requires minifyEnabled true.
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
The above code will apply your ProGuard configurations contained in proguard-rules.pro (“proguard-project.txt” in Eclipse) to your released apk.
To enable you to later determine the line on which an exception occurred in a stack trace, “proguard-rules.pro” should contain following lines:
-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
To enable Proguard in Eclipse add proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt to “project.properties”
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents