Android Question SQLiteCantOpenDatabaseException when initialising KVS with folder from GetSafeDirDefaultExternal

Derek Johnson

Active Member
Licensed User
Longtime User
I'm recently starting to see errors from a deployed application from just one user using a Motorola Moto G(4) (athene), Android 7.0.
The error is :


android.database.sqlite.SQLiteCantOpenDatabaseException
:

at android.database.sqlite.SQLiteConnection.nativeOpen (Native Method)

at android.database.sqlite.SQLiteConnection.open (SQLiteConnection.java:209)

at android.database.sqlite.SQLiteConnection.open (SQLiteConnection.java:193)

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:808)

at android.database.sqlite.SQLiteDatabase.open (SQLiteDatabase.java:793)

at android.database.sqlite.SQLiteDatabase.openDatabase (SQLiteDatabase.java:696)

at android.database.sqlite.SQLiteDatabase.openDatabase (SQLiteDatabase.java:671)

at anywheresoftware.b4a.sql.SQL.Initialize (SQL.java:44)

at org.uk100.MyLibSuffolk.keyvaluestore._initialize (keyvaluestore.java:259)

at org.uk100.MyLibSuffolk.starter._service_create (starter.java:278)

The KVS code is started in the Starter module

B4X:
Sub Process_Globals
....
    Dim KVS As KeyValueStore  'This is the first version v1.01
    Dim RP As RuntimePermissions
    Dim SafeFolder As String
    ...
End Sub
Sub Service_Create
    SafeFolder=RP.GetSafeDirDefaultExternal("")
    'Error occurs here:'
    KVS.Initialize(SafeFolder ,"kvs")
    ...
End Sub

This is from the Manifest:

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="28"/>
<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"/>
)

Can anyone suggest what might be causing this? Lack of space on the device possibly?

Derek
 
Top