I\'ve just built an APK using Gradle for release (ProGuard 4.9 and signed). When I launch the app it crash on this error :
E/AndroidRuntime( 8662): java.lan
You have to tell ProGuard to keep some enum
methods.
The Android SDK tools use this ProGuard configuration to achieve it:
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
You can either add the above rule to your ProGuard configuration or you can (what I'd prefer) include the default Android rules:
minifyEnabled true
proguardFile getDefaultProguardFile('proguard-android.txt')
proguardFile file('./proguard-project.txt')
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.zonaprop.android, PID: 20337
java.lang.AssertionError: Missing field in
...
Caused by: java.lang.NoSuchFieldException:
at java.lang.Class.getField
The follow answer worked for me https://stackoverflow.com/a/30167048/5279996