22

当我尝试在项目属性中将项目构建目标更改为 4.1 google API 时,我的 logcat 中出现这些错误。我试图修复项目属性并清理项目,但没有成功。有什么问题?

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
4

1 回答 1

31

确保您只使用过一个SQLiteDatabase. 我猜您已经实例化了多个实例,因此 Android 会抱怨。

你也应该看看这篇关于这个主题的博客文章

于 2012-10-07T15:58:27.600 回答