Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 670
Robert Avatar asked Nov 10 '22 00:11

Robert


1 Answers

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`  
like image 167
赵文超 Avatar answered Nov 14 '22 22:11

赵文超