简体   繁体   中英

DaoConfig init failure with greendao on Samsung Devices with Android 5.0

Crashlytics is reporting a lot of crashes 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)

Seems to be only Samsung devices (SM-G900V, SM-900A, SM-900P, SM-870A, SCH-545 etc) all running Android 5.0 Lollipop.

From my research there seems to be a Samsung class loader implementation issue on their devices that's causing this. People mentioned the possible loader as a problem in this issue: https://code.google.com/p/gmaps-api-issues/issues/detail?id=8314

People have suggested adding keep rules to Proguard but we're not using Proguard at all in the application. We do have multidexing enabled though.

Anyone have suggestions for fixes or workarounds?

I've encountered the same problem. I know it's the a proguard problem.

if you use the greenDao version above 3.2.0 just try the proguard-rules below

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

Try add this into your proguard-rules

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM