我的应用程序运行良好,但是当我们第一次对其进行升级时,它显示了我们在Google Play中的堆栈跟踪中获得的错误。

我的代码:

public Cursor getContentData(String pc, String sc) {

        return database.rawQuery("SELECT * FROM content where pc=" + pc
                + " and sc=" + sc + "", null);
    }


错误

java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:200)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
at java.lang.Thread.run(Thread.java:1027)
Caused by: java.lang.IllegalStateException: get field slot from row 0 col 16 failed
at android.database.CursorWindow.getString_native(Native Method)
at android.database.CursorWindow.getString(CursorWindow.java:369)
at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:49)
at com.zengamedia.parser.LoadLiveData.doInBackground(LoadLiveData.java:68)
at com.zengamedia.parser.LoadLiveData.doInBackground(LoadLiveData.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)

最佳答案

正如您的错误所说的那样:


  原因:java.lang.IllegalStateException:从第0行获取字段槽
  col 16失败


可能第17列是您的数据库查询语句中缺少的部分。

关于android - java.lang.IllegalStateException:从第0行第16列获取字段槽失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13908937/

10-10 06:08