Hello, I am struggling in applying proguard for android library,… The problem is that, I need to keep only 2 folders inside of a library, everything else should be minimized. The problem is that, I can’t make it work successfully. I tried various ways, but if client does not enable proguard, the code of library is clear and visible, just many Red colored, not found classes. How should I always ensure that my library is obscured ?
This is my library gradle and proguard setup(What am I doing wrong?):
-keepattributes InnerClasses
-keep public class com.test.test.initialization** {
public protected *;
}
-keep public class com.test.test.models** {
public protected *;
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep public class com.test.test.additional.enums** {
public protected *;
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keepclassmembers enum * { *; }
-keepclassmembers enum com.test.test.** { *; }
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-dontwarn okhttp3.internal.platform.*
-dontwarn okio.**
-dontwarn retrofit2.Platform$Java8
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.**
-dontnote retrofit2.Platform
-dontwarn retrofit2.Platform$Java8
-verbose
App cannot access some fragments, but can access MainActivity, which is not obscured and methods are visible
My gradle:
buildTypes {
release {
debuggable false
useProguard true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
I am publishing library with Maven, with novoda:bintray-release plugin
Also I still can’t properly keep enum values, it crashed app in some places.