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

十年热恋 提交于 2019-11-28 08:56:45
still_learning

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')
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!