Android greendao error could not init DAOConfig

I have encountered it before and solved it, but there is no record of it. I will record it this time.

There was no problem before obfuscation was turned on, but an error was reported after obfuscation was turned on. In combination with litepal, confusion rules need to be added and bean classes also need to be annotated with @Keep to prevent confusion, so it seems that confusion needs to be configured.

Solution:

Add code under your obfuscation configuration file:

-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
    public static void dropTable(org.greenrobot.greendao.database.Database, boolean);
    public static void createTable(org.greenrobot.greendao.database.Database, boolean);
}
-keep class org.greenrobot.greendao.**{*;}
-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {     public static java.lang.String TABLENAME; }
-keep class **$Properties{*;}

Re-running solved it!

Guess you like

Origin blog.csdn.net/LoveFHM/article/details/133684313