Android Question SQLCipher

Discussion in 'Android Questions' started by Cassie, Nov 29, 2016.

  1. Cassie

    Cassie Member Licensed User

    Hi Guys,

    Im working with this SQLCipher but unfortunately i the app closes after initialization of db

    Dim SQLCipher1 As SQLCipher -- This was declare in process global

    If SQLCipher1.IsInitialized = False Then
    End If

    Dim Cursor1 As Cursor


    Unfortunately, <Application Name> has stopped.

    Cursor1 = SQLCipher1.ExecQuery("SELECT transaction_no FROM transactions")
    Msgbox(Cursor1.GetString("transaction_no"), "")

    I have already copied the icudt46l on the asset directory.

    Thanks in advance.
  2. Erel

    Erel Administrator Staff Member Licensed User

    Moved to the questions forum.

    1. Please use [code]code here...[/code] tags when posting code.

    2. Run your app in debug mode and post the error message from the logs.
  3. Cassie

    Cassie Member Licensed User

    Thanks for the tip, I'm trying to famliarize procedures and hot to's in this forum. Anyway, I'll try to check it again in debug mode. Thank You.
  4. Cassie

    Cassie Member Licensed User


    I tried to run it on debugger but it seems after the Log("Execute SELECT query here.") the application closed and stop.

    Sub Activity_Create(FirstTime As Boolean)
    If SQLCipher1.IsInitialized = False Then
    Dim Cursor As Cursor
    Cursor = SQLCipher1.ExecQuery ("PRAGMA cipher_migrate"'<==== only enter this line
    Log("Execute SELECT query here.")
    Cursor = SQLCipher1.ExecQuery("SELECT * FROM transactions")
    Cursor.Position =0
    Msgbox(Cursor.GetString("transaction_no"), "")
    End If
    End Sub
    And here is the log file
    ** Service (starter) Create **
    ** Service (starter) Start **
    ** Activity (main) Create, isFirst = true **
    Execute SELECT query here.
    Connected to B4A-Bridge (Wifi)
    sending message to waiting queue (CallSubDelayed - UpdateStatus)
    Ignoring event (too many queued events: CallSubDelayed - UpdateStatus)

    Anyways, I'm using SQLiteStudio 3.1.1 when creating a SQLCipher database.

    Thanks in advance.
  5. Erel

    Erel Administrator Staff Member Licensed User

    Your code is wrong, though it is not the cause of this error.
    You need to initialize SQLCipher once in Service_Create of the starter service. Your current code will copy the original file multiple times.

    My guess is that SQLiteStudio uses a different version of SQLCipher. Try to create the database on the device and see whether it works.

    You can switch to USB debug mode instead of B4A-Bridge. It will show the error message.
  6. Cassie

    Cassie Member Licensed User

    Hi Erel,

    Thanks for the tip, maybe you're right the my SQLiteStudio uses different version of SQLCipher. I tried to create SQLCipher database programmatically in the device and it works perfectly.

    Thank you very much.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice