Android Question SQLiteException: not an error (code 0): Could not open the database in r/w mode

CristiMatei

Member
Licensed User
Longtime User
Hi.

Does anybody know why is this happening?

I have a sqlite db for browsing and everything works ok when I'm compiling with the option "Debug".
If I'm changing to "Release" I get "android.database.sqlite.SQLiteException: not an error (code 0): Could not open the database in read/write mode." message when I'm trying to connect to database.

Thank You
 

eps

Expert
Licensed User
Longtime User
Yep, you need to be doing something like this :

B4X:
                'Database hasn't been copied to read/write area

                If FirstTime = True Then

                    If File.Exists(File.DirInternal,"thedatabase.db") = False Then

                        File.Copy(File.DirAssets,"thedatabase.db",File.DirInternal,"thedatabase.db")
                    End If
                End If
 
Upvote 0

johnB

Active Member
Licensed User
Longtime User
Interesting, I had the same problem , one app has worked without a problem since day 1, now I've copied the basics into another app, using the same SQlite db and got this read/write error on Release.

Just by referring to File.DirDefaultExternal with Dim a As String = File.DirDefaultExternal in the Sub Activity_Create(FirstTime As Boolean) fixed the problem???????????

My DB is not in that Folder either
 
Upvote 0
Top