2012-10-07 78 views
22

我在我的logcat中得到這些錯誤,當我嘗試將項目屬性中的項目生成目標更改爲4.1 google API時。我試圖修復項目屬性和清理項目,但沒有成功。有什麼問題?嘗試重新打開已關閉的對象:SQLiteDatabase

10-07 15:13:34.839: E/Trace(731): error opening trace file: No such file or directory (2) 
10-07 15:13:35.259: I/SQLiteConnectionPool(731): The connection pool for /data/data/hr.punctum.LociranjePonudaProizvoda/databases/proizvodidb has been closed but there are still 1 connections in use. They will be closed as they are released back to the pool. 
10-07 15:13:35.259: D/AndroidRuntime(731): Shutting down VM 
10-07 15:13:35.259: W/dalvikvm(731): threadid=1: thread exiting with uncaught exception (group=0x40a13300) 
10-07 15:13:35.278: E/AndroidRuntime(731): FATAL EXCEPTION: main 
10-07 15:13:35.278: E/AndroidRuntime(731): java.lang.RuntimeException: Unable to start activity ComponentInfo{hr.punctum.LociranjePonudaProizvoda/hr.punctum.LociranjePonudaProizvoda.ListaProizvoda}: java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/hr.punctum.LociranjePonudaProizvoda/databases/proizvodidb 
10-07 15:13:35.278: E/AndroidRuntime(731): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059) 
10-07 15:13:35.278: E/AndroidRuntime(731): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
10-07 15:13:35.278: E/AndroidRuntime(731): at android.app.ActivityThread.access$600(ActivityThread.java:130) 
10-07 15:13:35.278: E/AndroidRuntime(731): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
10-07 15:13:35.278: E/AndroidRuntime(731): at android.os.Handler.dispatchMessage(Handler.java:99) 
10-07 15:13:35.278: E/AndroidRuntime(731): at android.os.Looper.loop(Looper.java:137) 
10-07 15:13:35.278: E/AndroidRuntime(731): at android.app.ActivityThread.main(ActivityThread.java:4745) 
10-07 15:13:35.278: E/AndroidRuntime(731): at java.lang.reflect.Method.invokeNative(Native Method) 
10-07 15:13:35.278: E/AndroidRuntime(731): at java.lang.reflect.Method.invoke(Method.java:511) 
10-07 15:13:35.278: E/AndroidRuntime(731): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
10-07 15:13:35.278: E/AndroidRuntime(731): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
10-07 15:13:35.278: E/AndroidRuntime(731): at dalvik.system.NativeStart.main(Native Method) 
10-07 15:13:35.278: E/AndroidRuntime(731): Caused by: java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/hr.punctum.LociranjePonudaProizvoda/databases/proizvodidb 
10-07 15:13:35.278: E/AndroidRuntime(731): at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55) 
10-07 15:13:35.278: E/AndroidRuntime(731): at android.database.sqlite.SQLiteDatabase.endTransaction(SQLiteDatabase.java:520) 
10-07 15:13:35.278: E/AndroidRuntime(731): at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:263) 
10-07 15:13:35.278: E/AndroidRuntime(731): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164) 
10-07 15:13:35.278: E/AndroidRuntime(731): at hr.punctum.LociranjePonudaProizvoda.ListaProizvoda.onCreate(ListaProizvoda.java:27) 
10-07 15:13:35.278: E/AndroidRuntime(731): at android.app.Activity.performCreate(Activity.java:5008) 
10-07 15:13:35.278: E/AndroidRuntime(731): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
10-07 15:13:35.278: E/AndroidRuntime(731): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
10-07 15:13:35.278: E/AndroidRuntime(731): ... 11 more 

回答

31

請確保您只使用SQLiteDatabase的一個實例。我猜你已經實例化了多個實例,Android正在抱怨。

你也應該看看這個主題blog post

+0

博客文章鏈接真的很有用! – MTurPash

+0

我沒有使實例方法作爲同步,這是導致此錯誤。謝謝噸 – user1035292

+0

因此,您的評論應該是真正的答案。 – zgulser

相關問題