Question One
java.lang.RuntimeException: Unable to start activity ComponentInfo
{com.mapoto4.mapoweather/com.mapoto4.mapoweather.MainActivity}
dbname is empty or not defined in litepal.xml file
分析:數(shù)據(jù)庫(kù)字段名錯(cuò)誤或者數(shù)據(jù)庫(kù)不存在橄碾。在Litepal數(shù)據(jù)庫(kù)創(chuàng)建之前就調(diào)用了聚集函數(shù)务热,比如Count,max等殉摔,在源碼中能夠找到DataSupport.count(xxx.class)的過程中沒有走創(chuàng)建數(shù)據(jù)庫(kù)的過程焰雕,所以報(bào)bdname is empty的問題掺栅。</br>
解決方法:經(jīng)過反復(fù)的排查烙肺,確定了在建立litpal.xml時(shí)文件類型產(chǎn)生錯(cuò)誤。