Android Question SQLCipher on KitKat

Rusty

Well-Known Member
Licensed User
Longtime User
I have been running several programs on pre-KitKat tablets and they have been running on hundreds of devices across the US, without fail.
The programs all use SQLCipher when i use b4abridge and connect to a pre-KitKat tablet all works wonderfully :);
Then I disconnect from the pre-KitKat tablet and immediately connect to the KitKat tablet
then I try to run them on KitKat i get:

net.sqlcipher.database.SQLiteException: not an error
at net.sqlcipher.database.SQLiteDatabase.dbopen(Native Method)
at net.sqlcipher.database.SQLiteDatabase.<init>(SQLiteDatabase.java:1951)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:901)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:948)
at anyhwheresoftware.b4a.objects.sqlcipher.SQLCipher.Initialize(SQLCipher.java:51)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:742)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:265)
at talkingsurvey.b4a.survey.fn._opendatabase(fn.java:429)
at talkingsurvey.b4a.survey.fn._loadfacility(fn.java:5817)
at talkingsurvey.b4a.survey.main._xmlprofileparser_endelement(main.java:26522)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:697)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.objects.SaxParser$MyHandler.endElement(SaxParser.java:121)
at org.apache.harmony.xml.ExpatParser.endElement(ExpatParser.java:156)
at org.apache.harmony.xml.ExpatParser.appendBytes(Native Method)
at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:513)
at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:474)
at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:316)
at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:279)
at anywheresoftware.b4a.objects.SaxParser.parse(SaxParser.java:80)
at anywheresoftware.b4a.objects.SaxParser.Parse(SaxParser.java:73)
at talkingsurvey.b4a.survey.main._loadmydeviceinfo(main.java:2124)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:697)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at talkingsurvey.b4a.survey.main.afterFirstLayout(main.java:102)
at talkingsurvey.b4a.survey.main.access$000(main.java:17)
at talkingsurvey.b4a.survey.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5118)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
at dalvik.system.NativeStart.main(Native Method)

The SQLCipher file is icudt46l.zip
The library is v1.20

B4X:
If Main.SQLSurvey.IsInitialized = False Then
Try              'assume it's cipher encrypted
       Main.SQLSurvey.initialize("/storage/emulated/0/survey/data", "database.db3", False, Main.SqliteKey, File.DirAssets )
Catch  'in case the sqlite file is NOT encrypted
     Main.SQLSurvey.initialize("/storage/emulated/0/survey/data", "database.db3", False, "", File.DirAssets)            
End Try
End If

Is there something I need to do to make the exact same working code to work on KitKat and use the SQLCipher library?
Thanks,
Rusty
 
Last edited:

Daniel-White

Active Member
Licensed User
Longtime User
I am using SQLcipher too, one question, the DB exist ?, before execute the next code:
Main.SQLSurvey.initialize("/storage/emulated/0/survey/data", "database.db3", False, Main.SqliteKey, File.DirAssets)

What append if change False to True, ?

what happen if change the path :
/storage/emulated/0/survey/data
By
/storage/emulated/legacy/survey/data

Daniel White
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
Thanks Erel,
Always a pleasure to work with you and the "blog". :) That worked! Both on KitKat and prior :)
Rusty
 
Upvote 0
Top