Android: ProGuard source code


Enable ProGuard in Android gradle build, make sure that the build variant is same.

minifyEnabled true
Add following snippet to App 'proguard-rules.pro' file
-optimizationpasses 5
-dontusemixedcaseclassnames-dontskipnonpubliclibraryclasses-dontskipnonpubliclibraryclassmembers-dontpreverify-dontnote-ignorewarnings-verbose-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

# not to proguard dependent library packages 
-keep class com.squareup.**
-keep class com.android.volley.**

# not to proguard android components
-keep public class * extends android.app.Activity -keep public class * extends android.app.Fragment -keep public class * extends android.support.v4.app.Fragment -keep public class * extends android.app.Application -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -dontwarn ** -dontnote ** # to generate the mapping.txt file -printmapping mapping.txt

Comments

Popular posts from this blog

Working with Android Hierarchy Viewer

Android: Standalone login with SQLiteOpenHelper