DaoConfig initiates crash with greendao on Samsung devices with Android 5.0

Crashlytics reports a large number of glitches in greendao:

> Caused by de.greenrobot.dao.DaoException: Could not init DAOConfig
>        at de.greenrobot.dao.internal.DaoConfig.<init>(DaoConfig.java:94)
>        at de.greenrobot.dao.AbstractDaoMaster.registerDaoClass(AbstractDaoMaster.java:44)
> ... Caused by java.lang.NoSuchFieldException: TABLENAME
>        at java.lang.Class.getField(Class.java:1104)
>        at de.greenrobot.dao.internal.DaoConfig.<init>(DaoConfig.java:56)
>        at de.greenrobot.dao.AbstractDaoMaster.registerDaoClass(AbstractDaoMaster.java:44)

It seems that only Samsung devices (SM-G900V, SM-900A, SM-900P, SM-870A, SCH-545, etc.) all work Android 5.0.

From my research, it seems that the problem of introducing a Samsung class bootloader on their devices causes this. People mentioned a possible bootloader as a problem in this question: https://code.google.com/p/gmaps-api-issues/issues/detail?id=8314

People suggested adding Proguard rules, but we don’t use Proguard at all in the application. However, we support multidexing.

Anyone have suggestions for fixes or workarounds?

+4
2

. , .

greenDao 3.2.0, proguard

-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
    public static java.lang.String TABLENAME;
}
-keep class **$Properties`  
+1

proguard

-keepclassmembers class * extends de.greenrobot.dao.AbstractDao {
    public static java.lang.String TABLENAME;
}
-keep class **$Properties
0

Source: https://habr.com/ru/post/1619437/


All Articles