Android release APK crash with java.lang.AssertionError: impossible in java.lang.Enum

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
-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')

Leave a Comment