Skip to content Skip to sidebar Skip to footer

Green Dao Could Not Init Daoconfig

I tried to use an old android application, that's use Green Dao such us database also this applicatioh had a flavour, so I compile and I install the apk but the app wan't start it

Solution 1:

I add the proguard-rules below.

-keep classxxx.dao.**{*;}

(xxx is the packageName where I put the DAO class file.)

It works for me.

Solution 2:

------ property declare like this ------

publicclassFolderDaoextendsAbstractDao<Folder, Long> {
publicstaticfinalStringTABLENAME="FOLDER";
private DaoSession daoSession;

publicstaticclassProperties {
    publicstaticfinalPropertyFolderPath=newProperty(8, String.class, "folderPath", false, "FOLDER_PATH");
    publicstaticfinalPropertyFolderSourceId=newProperty(5, Long.class, "folderSourceId", false, "FOLDER_SOURCE_ID");
    publicstaticfinalPropertyId=newProperty(0, Long.class, "id", true, "_id");
    publicstaticfinalPropertyIsCamera=newProperty(3, Boolean.class, "isCamera", false, "IS_CAMERA");
    publicstaticfinalPropertyIsHidden=newProperty(7, Boolean.class, "isHidden", false, "IS_HIDDEN");
    publicstaticfinalPropertyIsUserCreated=newProperty(6, Boolean.class, "isUserCreated", false, "IS_USER_CREATED");
    publicstaticfinalPropertyName=newProperty(1, String.class, "name", false, "NAME");
    publicstaticfinalPropertySource=newProperty(4, Integer.class, "source", false, "SOURCE");
    publicstaticfinalPropertyUserType=newProperty(2, String.class, "userType", false, "USER_TYPE");
}

publicFolderDao(DaoConfig daoConfig) {
    super(daoConfig);
}

publicFolderDao(DaoConfig daoConfig, DaoSession daoSession) {
    super(daoConfig, daoSession);
    this.daoSession = daoSession;
}

if you don't write public so occur error like Caused by: de.greenrobot.dao.DaoException: Could not init DAOConfig or static than Caused by: java.lang.NullPointerException: Attempt to read from field 'int de.greenrobot.dao.Property.ordinal' on a null object reference

Post a Comment for "Green Dao Could Not Init Daoconfig"