ORMLite抛Can't find a no-arg constructor for class异常



java.lang.IllegalArgumentException: Can't find a no-arg constructor for class


 Caused by: java.lang.IllegalArgumentException: Can't find a no-arg constructor for class com.xxx.xxx.xxx.xxx
            at com.j256.ormlite.table.DatabaseTableConfig.findNoArgConstructor(DatabaseTableConfig.java:196)
            at com.j256.ormlite.table.DatabaseTableConfig.getConstructor(DatabaseTableConfig.java:126)
            at com.j256.ormlite.table.TableInfo.<init>(TableInfo.java:94)
            at com.j256.ormlite.dao.BaseDaoImpl.initialize(BaseDaoImpl.java:154)
            at com.j256.ormlite.dao.BaseDaoImpl.<init>(BaseDaoImpl.java:128)
            at com.j256.ormlite.dao.BaseDaoImpl.<init>(BaseDaoImpl.java:119)
            at com.j256.ormlite.dao.BaseDaoImpl$5.<init>(BaseDaoImpl.java:921)
            at com.j256.ormlite.dao.BaseDaoImpl.createDao(BaseDaoImpl.java:921)
            at com.j256.ormlite.dao.DaoManager.createDao(DaoManager.java:72)
            at com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper.getDao(OrmLiteSqliteOpenHelper.java:279)


找了好久,最后才发现,ORMLite建表的类需要有一个无参数的构造函数,由于我重写加了参数,所以抛了异常。。。

加一个无参数的构造函数问题解决。



你可能感兴趣的:(ORMLite抛Can't find a no-arg constructor for class异常)