Domanda

Sto creando un'applicazione con SQLite.Quando recupero i valori dal database, ricevo l'errore seguente:

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)

I dati recuperati dal database richiedono molto tempo per essere visualizzati, il che penso sia dovuto a questo errore.Qualche suggerimento su come risolverlo?

È stato utile?

Soluzione

Sembra che tu apra il database ma non lo chiuda mai...?O forse un file di database corrotto...?Prova a disinstallare il programma ed eseguilo di nuovo.Ricevi lo stesso errore la prima volta che lo esegui?- o la seconda volta?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top