android {
//...
buildTypes {
release {
minifyEnabled true // Change value with true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
In that case, all the classes are encrypted.
You can change your proguard-rules.pro
to keep visible specific classes and methods.
-keep classmembers class your.package.classname {
*; #KEEP ALL
}
Example:
-keep public class com.mikhaellopez.MyClass {
public static final <fields>;
public <methods>;
}
You can also apply it to a whole package:
-keep class your.package.* {
*;
}
Code | Keep effect |
---|---|
*; |
KEEP ALL |
public static final <fields>; |
KEEP ALL PUBLIC ATTRIBUTES |
public <methods>; |
KEEP ALL PUBLIC METHODS |
public *; |
KEEP ALL PUBLIC METHODS AND ATTRIBUTES |
public void onCreate(...); |
KEEP SPECIFIC METHOD |
<fields>; |
KEEP ALL FIELDS |
<methods>; |
KEEP ALL METHODS |
You can see other best Android Gists or offer your just here https://github.com/lopspower/BestAndroidGists 👍.