Android之litepal创建数据库失败

来源:互联网 发布:产品图册制作软件 编辑:程序博客网 时间:2024/05/21 10:51
最近在写学习第二版的第一行代码,实战运行项目总是失败,然后报错
org.litepal.exceptions.DatabaseGenerateException: can not find a class named com.example.coolerweath

搜索一番原来是LitePal.xml中的建表语句路径错误,
<list>
<mapping class="com.example.coolerweather.db.Province" />
<mapping class="com.example.coolerweather.db.City" />
<mapping class="com.example.coolerweather.db.County" />
</list>

这个里面db之前的路径要和当前包名一致才行。修改后就可以运行了。