Android Question Help What is this error?

dhernandez

Active Member
Licensed User
I'm working com SQLCipher to protect my data.
Where I have my device testing and works great, but when installed on a different computer this is what gives me.

 

dhernandez

Active Member
Licensed User
B4X:
LogCat connected to: B4A-Bridge: samsung SCH-M828C-A00000306C2CF1
--------- beginning of /dev/log/system
--------- beginning of /dev/log/main
** Activity (main) Create, isFirst = false **
running waiting messages (1)
** Activity (main) Resume **
** Service (service1) Destroy **
** Service (service1) Create **
** Service (service1) Start **
Connected to B4A-Bridge (Wifi)
** Activity (main) Pause, UserClosed = true **
Installing file.
PackageAdded: package:b4a.example
** Activity (main) Create, isFirst = true **
main_activity_create (B4A line: 53)
SQLPrincipal.Initialize(ruta,"dimmer.db", True,"9876543210", ruta)
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 b4a.example.main._activity_create(main.java:271)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:521)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
    at b4a.example.main.afterFirstLayout(main.java:89)
    at b4a.example.main.access$100(main.java:16)
    at b4a.example.main$WaitForLayout.run(main.java:74)
    at android.os.Handler.handleCallback(Handler.java:587)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:4627)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:521)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    at dalvik.system.NativeStart.main(Native Method)
This error when running the application.

and the following is the code I write:

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:

        MyFirstTime=True
'            ToastMessageShow("Iniciando Aplicación, Espere...", False)
            File.MakeDir(CreaFolder,"Phot")
           
                            
                '****** Crea la base de datos ******
                If File.Exists(ruta, "dimmer.db")=False Then
                    SQLPrincipal.Initialize(ruta,"dimmer.db", True,"9876543210", ruta)
                   
                    SQLPrincipal.ExecNonQuery("CREATE TABLE t_extintor_titulo (empresa TEXT, folio TEXT, fecha_prog TEXT, cserv TEXT, usuario_inspector TEXT, fecha_real TEXT, hra_real TEXT)")
                    SQLPrincipal.ExecNonQuery("CREATE TABLE t_extintor_det (empresa TEXT, folio TEXT, extintor TEXT, extintor_param TEXT, valor TEXT)")
                    SQLPrincipal.ExecNonQuery("CREATE TABLE t_extintor (empresa TEXT, cserv TEXT, extintor TEXT, extintor_cod TEXT, extintor_qr TEXT, extintor_desc TEXT, extintor_agente TEXT, extintor_capacidad TEXT, extintor_estatus TEXT)")
                    SQLPrincipal.ExecNonQuery("CREATE TABLE t_extintor_foto (empresa TEXT, folio TEXT, extintor TEXT, foto BLOB)")
                    SQLPrincipal.ExecNonQuery("CREATE TABLE c_extintor_param (empresa TEXT, extintor_param TEXT, extintor_param_desc TEXT, norma TEXT, extintor_valor0 TEXT, extintor_valor1 TEXT)")
                    SQLPrincipal.ExecNonQuery("CREATE TABLE c_cserv (empresa TEXT, cserv TEXT, ofna TEXT, zona TEXT, cserv_nom TEXT, cserv_qr TEXT, cserv_estatus TEXT)")
                    SQLPrincipal.ExecNonQuery("CREATE TABLE c_empresa (empresa TEXT, empresa_nom TEXT)")
                    SQLPrincipal.ExecNonQuery("CREATE TABLE c_norma (empresa TEXT, norma, norma_desc TEXT)")
                    'SQLPrincipal.Initialize(ruta,"dimmer.db",True,"9876543210",ruta)
                    'CURSORPrincipal.IsInitialized
                Else
                    SQLPrincipal.Initialize(ruta,"dimmer.db",True,"9876543210",ruta)
                    CURSORPrincipal.IsInitialized   
                End If
                       
       
    Activity.LoadLayout("Prueba")
End Sub
The line error:
B4X:
SQLPrincipal.Initialize(ruta,"dimmer.db", True,"9876543210", ruta)
Help Please
 

stevel05

Expert
Licensed User
You have too many parameters in SQL initialize, It should be:

SQLPrincipal.Initialize(ruta,"dimmer.db", True)

What are the additional fields intended to do?
 

dhernandez

Active Member
Licensed User
SQLCipher use to encrypt the data, but if I use the SQLite Normal, works well and on any phone. :(
 

stevel05

Expert
Licensed User
OK, you haven't shown the Dim for the SQLPrincipal. I'm afraid I haven't used SQLCipher. Hopefully someone that has can help you.
 

dhernandez

Active Member
Licensed User
Thnks for your comments
 

dhernandez

Active Member
Licensed User
Thanks, it was simple.
You only have to add the file. to the files folder. Without that file. I worked on an emulator to case, but in a real phone you need to put the file, comes within the library SQLCipher ..

Thank you
 
Top