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

今天在使用ormLite创建表的时候,想通过有参构造函数携带一个字段进去,没想到运行起来直接崩溃,并报了下面这个异常

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.field.FieldType.configDaoInformation(FieldType.java:341)
at com.j256.ormlite.dao.BaseDaoImpl.initialize(BaseDaoImpl.java:201)
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)

看报错提示是找不到无参构造函数,这个时候再加一个无参的构造函数问题就解决了!
但是为什么会这样,还没来得及分析,之后找到问题所在再拿出来分析!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值