I have a working application in Google Play Store that is usually highly reliable but I've recently had 8 exceptions reported on a single UMI Plus device running Android 7 when SQL is initialised by the KeyValueStore.
I've just realised that this is a classic example of needing to initialise SQL and other items in the Starter Module. DOH!
I'm using b4a Version 8.5, the SQL Library is V1.5
This is the code that causes the error. Any suggestions on what is happening here?
These are the reported exception details:
This is part of the manifest editor:
I've just realised that this is a classic example of needing to initialise SQL and other items in the Starter Module. DOH!
I'm using b4a Version 8.5, the SQL Library is V1.5
This is the code that causes the error. Any suggestions on what is happening here?
B4X:
'Starter:
Sub Process_Globals
'...
Dim RP As RuntimePermissions
Dim SafeFolder
'....
end sub
Sub Service_Create
'...
SafeFolder=RP.GetSafeDirDefaultExternal("")
'...
end sub
'In Main
Sub Process_Globals
'...
Dim KVS As KeyValueStore
'....
end sub
Sub Activity_Create(FirstTime As Boolean)
StoreFolder=Starter.safeFolder
If FirstTime Then
KVS.Initialize(StoreFolder ,"kvs")
End If
end sub
'KeyValueStore:
'Initializes the store and sets the store file.
Public Sub Initialize (Dir As String, FileName As String)
If sql1.IsInitialized Then sql1.Close
'This line raises the exception
sql1.Initialize(Dir, FileName, True)
CreateTable
End Sub
These are the reported exception details:
android.database.sqlite.SQLiteException:
at android.database.sqlite.SQLiteConnection.nativeOpen (Native Method)
at android.database.sqlite.SQLiteConnection.open (SQLiteConnection.java:214)
at android.database.sqlite.SQLiteConnection.open (SQLiteConnection.java:198)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked (SQLiteConnectionPool.java:463)
at android.database.sqlite.SQLiteConnectionPool.open (SQLiteConnectionPool.java:185)
at android.database.sqlite.SQLiteConnectionPool.open (SQLiteConnectionPool.java:177)
at android.database.sqlite.SQLiteDatabase.openInner (SQLiteDatabase.java:838)
at android.database.sqlite.SQLiteDatabase.open (SQLiteDatabase.java:823)
at android.database.sqlite.SQLiteDatabase.openDatabase (SQLiteDatabase.java:716)
at android.database.sqlite.SQLiteDatabase.openDatabase (SQLiteDatabase.java:691)
at anywheresoftware.b4a.sql.SQL.Initialize (SQL.java:44)
at org.uk100.MyLibSuffolk.keyvaluestore._initialize (keyvaluestore.java:259)
at org.uk100.MyLibSuffolk.main._activity_create (main.java:499)
at java.lang.reflect.Method.invoke (Native Method)
at anywheresoftware.b4a.BA.raiseEvent2 (BA.java:191)
at org.uk100.MyLibSuffolk.main.afterFirstLayout (main.java:104)
at org.uk100.MyLibSuffolk.main.access$000 (main.java:17)
at org.uk100.MyLibSuffolk.main$WaitForLayout.run (main.java:82)
at android.os.Handler.handleCallback (Handler.java:836)
at android.os.Handler.dispatchMessage (Handler.java:103)
at android.os.Looper.loop (Looper.java:203)
at android.app.ActivityThread.main (ActivityThread.java:6247)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:924)
This is part of the manifest editor:
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
RemovePermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddManifestText(<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18"/>
)
Last edited: