Android Question SQLcipher Read/Write Problem **In Lollipop**

RichardN

Active Member
Licensed User
The code below is an extract from an app with over 2000 successful deployments. We all know an SQLite database must reside in a read/write directory... even if you are never writing to it. I now have a new user that gets an exception apparently at the SQL.Initialize statement.

B4X:
#Region  Project Attributes
    #CanInstallToExternalStorage: True
#End Region

Sub Process_Globals
    Dim SQL As SQLCipher
End Sub

Sub Activity_Create(FirstTime As Boolean)

    If FirstTime Then          'Reinitialize database every run

        File.Copy(File.DirAssets,"MyDatabase.sqlite",File.DirDefaultExternal ,"MyDatabase.sqlite")
        SQL.Initialize(File.DirDefaultExternal ,"MyDatabase.sqlite",False,z,"")     'I believe it halts here  

     End If

'Previous coding corrected for misplacement

End Sub
He sent this screenshot:



Copying the database from File.DirAssets to File.DirDefaultExternal did not throw an exception so it must follow that the destination folder is read & write. However when the SQL.Initialise statement is executed this happens.

The platform is an HTC One M9 with Android 5.0 Lollipop. Whilst I am waiting for further details of internal/external storage config, has anyone got the faintest idea what might cause this in an apparently mature application ?
 
Last edited:

RichardN

Active Member
Licensed User
Hi Erel,

Sorry that was my typo when I copied the code across, the SQLcipher object only gets initialised once in the release version.

I have tested the code on a different Lollipop platform with no issues. I am waiting to get hold of a subject device to have a look at the logs.
 

RichardN

Active Member
Licensed User
After much troubleshooting I have isolated the issue.

SQL Cipher appears incompatible with the HTC implementation of Lollipop. I have several users who report the runtime errors above after accepting the HTC upgrade to Lollipop for their M8 & M9 platforms. No amount of clean-installation with make this previously mature app run without errors.

I have replaced the database with an unencrypted version, commented out the SQLcipher initialisation and replaced it with the simple SQL object. In test I left the SQLcipher library attached and the icudt46l.zip present in /files. The compilation now runs without a problem. Unfortunately it seems I have no choice other than to remove SQLcipher from future projects as HTC/Lollipop user become more numerous.
 
Top