attempt to re-open an already-closed object

952 views
Skip to first unread message

Đại Trần Bá

unread,
Mar 14, 2018, 6:11:47 AM3/14/18
to ORMLite Android Users
Why occur exception if i reopen application:
Process: com.example.son.kotlinandroiddemo, PID: 14642
                  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.son.kotlinandroiddemo/com.example.son.kotlinandroiddemo.ListData}: java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/user/0/com.example.son.kotlinandroiddemo/databases/test.db
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
                      at android.app.ActivityThread.-wrap11(Unknown Source:0)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
                      at android.os.Handler.dispatchMessage(Handler.java:106)
                      at android.os.Looper.loop(Looper.java:164)
                      at android.app.ActivityThread.main(ActivityThread.java:6494)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
                   Caused by: java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/user/0/com.example.son.kotlinandroiddemo/databases/test.db
                      at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55)
                      at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1388)
                      at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1331)
                      at com.j256.ormlite.android.compat.JellyBeanApiCompatibility.rawQuery(JellyBeanApiCompatibility.java:21)
                      at com.j256.ormlite.android.AndroidCompiledStatement.getCursor(AndroidCompiledStatement.java:193)
                      at com.j256.ormlite.android.AndroidCompiledStatement.runQuery(AndroidCompiledStatement.java:72)
                      at com.j256.ormlite.stmt.SelectIterator.<init>(SelectIterator.java:57)
                  

Gray Watson

unread,
Mar 15, 2018, 1:24:45 PM3/15/18
to ORMLite Android
I don't know specifically. ORMLite is just trying to issue a query but the underlying database entry has been closed. I believe it means that your application is not properly detecting when it has been partially closed so it needs to reopen the database classes like DAOs.

gray
> --
> You received this message because you are subscribed to the Google Groups "ORMLite Android Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ormlite-andro...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages