支持v4 CursorLoader - 仅在少数设备上出现非常奇怪的错误

时间:2012-09-05 01:57:13

标签: android

只有少数用户出现以下错误,我真的不知道在哪里查找此错误,因为sql数据库文件位于正确的位置,sql管理器打开它然后找不到那里的表!!

我注意到这发生在使用支持V4库的CursorLoader时,可能是错误在该代码中?

任何建议或答案都会有所帮助。

java.lang.RuntimeException: An error occured while executing doInBackground()
    at android.support.v4.b.r.done(SourceFile:137)
    at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
    at java.lang.Thread.run(Thread.java:856)Caused by: android.database.sqlite.SQLiteException: no such table: records: , while compiling: SELECT _id, name, isbackground FROM records ORDER BY _id ASC
    at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
    at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:68)
    at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:143)
    at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:361)
    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:127)
    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:94)
    at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:53)
    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47)
    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1564)
    at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:354)
    at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:291)
    at com.voicepro.db.RecordsContentProvider.query(SourceFile:289)
    at android.content.ContentProvider$Transport.query(ContentProvider.java:178)
    at android.content.ContentResolver.query(ContentResolver.java:311)
    at android.support.v4.b.f.loadInBackground(SourceFile:49)
    at android.support.v4.b.f.loadInBackground(SourceFile:35)
    at android.support.v4.b.a.onLoadInBackground(SourceFile:240)
    at android.support.v4.b.b.doInBackground(SourceFile:51)
    at android.support.v4.b.b.doInBackground(SourceFile:40)
    at android.support.v4.b.q.call(SourceFile:123)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) android.database.sqlite.SQLiteException: no such table: records: , while compiling: SELECT _id, name, isbackground FROM records ORDER BY _id ASC
    at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
    at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:68)
    at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:143)
    at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:361)
    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:127)
    at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:94)
    at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:53)
    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47)
    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1564)
    at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:354)
    at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:291)
    at com.voicepro.db.RecordsContentProvider.query(SourceFile:289)
    at android.content.ContentProvider$Transport.query(ContentProvider.java:178)
    at android.content.ContentResolver.query(ContentResolver.java:311)
    at android.support.v4.b.f.loadInBackground(SourceFile:49)
    at android.support.v4.b.f.loadInBackground(SourceFile:35)
    at android.support.v4.b.a.onLoadInBackground(SourceFile:240)
    at android.support.v4.b.b.doInBackground(SourceFile:51)
    at android.support.v4.b.b.doInBackground(SourceFile:40)
    at android.support.v4.b.q.call(SourceFile:123)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
    at java.lang.Thread.run(Thread.java:856)

1 个答案:

答案 0 :(得分:1)

可能是一个损坏或不完整的数据库。检查发生了什么设备,并可能尝试获取数据库的副本。没有直接关联,但尽量不要混淆支持库,一些代码依赖于子类/方法名称。