Android中的数据库错误

时间:2010-10-30 09:31:51

标签: android android-sqlite

我正在使用SQLite停止应用程序。当我从数据库中获取值时,我收到以下错误:

10-30 15:06:07.584: ERROR/Database(817): Leak found
10-30 15:06:07.584: ERROR/Database(817): java.lang.IllegalStateException: /data/data/com.fitzsoftware.grocessaryList/databases/example.db SQLiteDatabase created and never closed
10-30 15:06:07.584: ERROR/Database(817):     at android.database.sqlite.SQLiteDatabase.<init>(SQLiteDatabase.java:1581)
10-30 15:06:07.584: ERROR/Database(817):     at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:638)
10-30 15:06:07.584: ERROR/Database(817):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:659)
10-30 15:06:07.584: ERROR/Database(817):     at android.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:652)
10-30 15:06:07.584: ERROR/Database(817):     at android.app.ApplicationContext.openOrCreateDatabase(ApplicationContext.java:482)
10-30 15:06:07.584: ERROR/Database(817):     at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:193)
10-30 15:06:07.584: ERROR/Database(817):     at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:98)
10-30 15:06:07.584: ERROR/Database(817):     at com.fitzsoftware.grocessaryList.DataHelper.<init>(DataHelper.java:46)
10-30 15:06:07.584: ERROR/Database(817):     at com.fitzsoftware.grocessaryList.MyShoppingList.onCreate(MyShoppingList.java:63)
10-30 15:06:07.584: ERROR/Database(817):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
10-30 15:06:07.584: ERROR/Database(817):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
10-30 15:06:07.584: ERROR/Database(817):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
10-30 15:06:07.584: ERROR/Database(817):     at android.app.ActivityThread.access$2100(ActivityThread.java:116)
10-30 15:06:07.584: ERROR/Database(817):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
10-30 15:06:07.584: ERROR/Database(817):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-30 15:06:07.584: ERROR/Database(817):     at android.os.Looper.loop(Looper.java:123)
10-30 15:06:07.584: ERROR/Database(817):     at android.app.ActivityThread.main(ActivityThread.java:4203)
10-30 15:06:07.584: ERROR/Database(817):     at java.lang.reflect.Method.invokeNative(Native Method)
10-30 15:06:07.584: ERROR/Database(817):     at java.lang.reflect.Method.invoke(Method.java:521)
10-30 15:06:07.584: ERROR/Database(817):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
10-30 15:06:07.584: ERROR/Database(817):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
10-30 15:06:07.584: ERROR/Database(817):     at dalvik.system.NativeStart.main(Native Method)

从数据库中提取的数据需要花费很多时间才能显示,我认为是因为这个错误。关于如何解决它的任何建议?

1 个答案:

答案 0 :(得分:1)

看起来你打开数据库但从未关闭它......?或者可能是一个损坏的数据库文件......?尝试卸载程序并再次运行。第一次运行时会出现同样的错误吗? - 还是第二次?