一般问题:我有数据库应用程序(创建数据库并允许将数据输入其中)。在模拟器(Nexus 7 API 22 Android 5.0.2)上运行时运行正常,但是当相同的应用程序在真实设备上运行时ASUS AOSP On Flo Android 5.1.1 API 22崩溃。在其他真实设备上运行应用程序索尼E5823 Android 6.0.1 API 23运行正常。
编辑:
logcat输出:
09-27 08:57:50.318 544-572/? I/ActivityManager: Displayed com.linux.site.mrt.mydatabaseexample/.MainActivity: +467ms
09-27 08:57:50.341 894-894/? I/LatinIME: Starting input. Cursor position = -1,-1
09-27 08:57:50.355 894-894/? E/RichInputConnection: Unable to connect to the editor to retrieve text.
09-27 08:57:50.355 894-894/? D/RichInputConnection: Will try to retrieve text later.
09-27 08:57:50.359 894-894/? I/InputAttributes: InputType.TYPE_NULL is specified
09-27 08:57:50.407 894-894/? I/LatinIME: Starting input. Cursor position = 0,0
09-27 08:58:01.265 10240-10240/? E/SQLiteLog: (1) no such table: results_table
09-27 08:58:01.267 10240-10240/? D/AndroidRuntime: Shutting down VM
09-27 08:58:01.268 10240-10240/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.linux.site.mrt.mydatabaseexample, PID: 10240
android.database.sqlite.SQLiteException: no such table: results_table (code 1): , while compiling: select * from results_table
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1316)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1255)
at com.linux.site.mrt.mydatabaseexample.DatabaseHelper.getAllData(DatabaseHelper.java:128)
at com.linux.site.mrt.mydatabaseexample.MainActivity$2.onClick(MainActivity.java:80)
at android.view.View.performClick(View.java:4780)
at android.view.View$PerformClick.run(View.java:19866)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
09-27 08:58:01.270 544-1123/? W/ActivityManager: Force finishing activity 1 com.linux.site.mrt.mydatabaseexample/.MainActivity
答案 0 :(得分:0)
tabel_Result
,如果清除模拟器上存储的数据,则会出现相同的错误。我认为你需要