Android 2.3.3 Eclipse Version: 3.7.0 LogCat
LogCat 报错信息:
02-13 11:58:12.030: WARN/dalvikvm(432): threadid=19: thread exiting with uncaught exception (group=0x40015560) 02-13 11:58:12.130: ERROR/AndroidRuntime(432): FATAL EXCEPTION: Thread-26 02-13 11:58:12.130: ERROR/AndroidRuntime(432): android.database.sqlite.SQLiteException: bind or column index out of range: handle 0x309b08 02-13 11:58:12.130: ERROR/AndroidRuntime(432): at android.database.sqlite.SQLiteProgram.native_bind_string(Native Method) 02-13 11:58:12.130: ERROR/AndroidRuntime(432): at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:244) 02-13 11:58:12.130: ERROR/AndroidRuntime(432): at android.database.sqlite.SQLiteQuery.bindString(SQLiteQuery.java:185) 02-13 11:58:12.130: ERROR/AndroidRuntime(432): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:48) 02-13 11:58:12.130: ERROR/AndroidRuntime(432): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1356) 02-13 11:58:12.130: ERROR/AndroidRuntime(432): at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1235) 02-13 11:58:12.130: ERROR/AndroidRuntime(432): at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1189) 02-13 11:58:12.130: ERROR/AndroidRuntime(432): at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1271) 02-13 11:58:12.130: ERROR/AndroidRuntime(432): at com.taobao.htc.db.RecordDBHelper.query(RecordDBHelper.java:50) 02-13 11:58:12.130: ERROR/AndroidRuntime(432): at com.taobao.htc.manage.RecordDBopt.get(RecordDBopt.java:78) 02-13 11:58:12.130: ERROR/AndroidRuntime(432): at com.taobao.htc.manage.RecordMessage.sendMseeage(RecordMessage.java:111) 02-13 11:58:12.130: ERROR/AndroidRuntime(432): at com.taobao.htc.manage.RecordMessage.sendMseeage(RecordMessage.java:87) 02-13 11:58:12.130: ERROR/AndroidRuntime(432): at com.taobao.htc.Report.run(Report.java:49) 02-13 11:58:12.130: ERROR/AndroidRuntime(432): at java.lang.Thread.run(Thread.java:1019) 02-13 11:58:12.200: WARN/ActivityManager(62): Force finishing activity com.taobao.htc/.WakeUp
发生错误原因分析:
发现是此处at com.taobao.htc.db.RecordDBHelper.query(RecordDBHelper.java:50)出现问题:
Cursor cur = db.query(TBL_NAME, null, where, args, null, null, order);
继续查找出错位置,发现传入的where和args参数,数组长度不一致。因此报错“绑定或列的索引超出范围”(android.database.sqlite.SQLiteException: bind or column index out of range)。
解决办法:
找到出错原因后,修改传入参数,保证传入参数where 与args长度一致。