Android 开发遇见的所有错误记录
1. FATAL EXCEPTION: AsyncTask #1 doInBackground()
原因:select语句拼写错误
如:String select = "((" + Contacts.DISPLAY_NAME + "NOTNULL ) AND (" + Contacts.DISPLAY_NAME + " != '' ))";将会报错 FATAL EXCEPTION: AsyncTask #1 doInBackground()
修改为String select = "((" + Contacts.DISPLAY_NAME + " NOTNULL ) AND (" + Contacts.DISPLAY_NAME + " != '' ))";错误消失
解释: select语句中需要使用空格隔开 Contacts.DISPLAY_NAME等表达式和语句NOTNULL等。
2. android 报错: error: Apostrophe not preceded by \
原因 xml 不支持 ' 修改we'll 为 we will 或 we\'ll
3. Caused by: java.lang.NoSuchMethodError: android.view.View.getTransitionName
原因:getTransitionName()方法为API21加入的。故出现NoSuchMehtodError
遇见此错误查看当前手机是否支持调用的api, 官方API文档每个方法右上角标注了api添加的版本。
关于
@SuppressLint("NewApi") 或者 @TargeApi(9)区别和注意事项
参见
http://blog.csdn.net/geekpark/article/details/39931683
浙公网安备 33010602011771号