Android Question Android 9 error only

yiankos1

Active Member
Licensed User
Hello,
As I see at bug reports from firebase and Google play console, users that have Android 9, encounter three kind of errors
B4X:
android.database.sqlite.SQLiteCantOpenDatabaseException
gr.taxabro.DiplomaAytokinitou.main._btntest_click
android.database.sqlite.SQLiteCantOpenDatabaseException:
  at android.database.sqlite.SQLiteConnection.nativeOpen (Native Method)
  at android.database.sqlite.SQLiteConnection.open (SQLiteConnection.java:211)
  at android.database.sqlite.SQLiteConnection.open (SQLiteConnection.java:195)
  at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked (SQLiteConnectionPool.java:503)
  at android.database.sqlite.SQLiteConnectionPool.open (SQLiteConnectionPool.java:204)
  at android.database.sqlite.SQLiteConnectionPool.open (SQLiteConnectionPool.java:196)
  at android.database.sqlite.SQLiteDatabase.openInner (SQLiteDatabase.java:880)
  at android.database.sqlite.SQLiteDatabase.open (SQLiteDatabase.java:865)
  at android.database.sqlite.SQLiteDatabase.openDatabase (SQLiteDatabase.java:766)
  at android.database.sqlite.SQLiteDatabase.openDatabase (SQLiteDatabase.java:714)
  at anywheresoftware.b4a.sql.SQL.Initialize (SQL.java:44)
  at gr.taxabro.DiplomaAytokinitou.main._btntest_click (main.java:1106)
  at java.lang.reflect.Method.invoke (Native Method)
  at anywheresoftware.b4a.BA.raiseEvent2 (BA.java:196)
  at anywheresoftware.b4a.BA.raiseEvent2 (BA.java:180)
  at de.donmanfred.IconButtonWrapper$1.onClick (IconButtonWrapper.java:73)
  at android.view.View.performClick (View.java:6608)
  at android.view.View.performClickInternal (View.java:6585)
  at android.view.View.access$3100 (View.java:785)
  at android.view.View$PerformClick.run (View.java:25921)
  at android.os.Handler.handleCallback (Handler.java:873)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:201)
  at android.app.ActivityThread.main (ActivityThread.java:6810)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:547)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:873)
B4X:
android.database.sqlite.SQLiteDatabaseCorruptException:
  at android.database.sqlite.SQLiteConnection.nativeExecuteForChangedRowCount (Native Method)
  at android.database.sqlite.SQLiteConnection.executeForChangedRowCount (SQLiteConnection.java:748)
  at android.database.sqlite.SQLiteSession.executeForChangedRowCount (SQLiteSession.java:754)
  at android.database.sqlite.SQLiteStatement.executeUpdateDelete (SQLiteStatement.java:64)
  at android.database.sqlite.SQLiteDatabase.executeSql (SQLiteDatabase.java:1771)
  at android.database.sqlite.SQLiteDatabase.execSQL (SQLiteDatabase.java:1698)
  at anywheresoftware.b4a.sql.SQL.ExecNonQuery (SQL.java:74)
  at gr.taxabro.DiplomaAytokinitou.main._btntest_click (main.java:1108)
  at java.lang.reflect.Method.invoke (Native Method)
  at anywheresoftware.b4a.BA.raiseEvent2 (BA.java:196)
  at anywheresoftware.b4a.BA.raiseEvent2 (BA.java:180)
  at de.donmanfred.IconButtonWrapper$1.onClick (IconButtonWrapper.java:73)
  at android.view.View.performClick (View.java:6608)
  at android.view.View.performClickInternal (View.java:6585)
  at android.view.View.access$3100 (View.java:785)
  at android.view.View$PerformClick.run (View.java:25921)
  at android.os.Handler.handleCallback (Handler.java:873)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:201)
  at android.app.ActivityThread.main (ActivityThread.java:6810)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:547)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:873)

B4X:
java.lang.NullPointerException:
  at gr.taxabro.DiplomaAytokinitou.test._vvvvvvvvvvvvvvvvvvvvvvvvv2 (test.java:1336)
  at gr.taxabro.DiplomaAytokinitou.test._activity_create (test.java:514)
  at java.lang.reflect.Method.invoke (Native Method)
  at anywheresoftware.b4a.BA.raiseEvent2 (BA.java:196)
  at gr.taxabro.DiplomaAytokinitou.test.afterFirstLayout (test.java:104)
  at gr.taxabro.DiplomaAytokinitou.test.access$000 (test.java:17)
  at gr.taxabro.DiplomaAytokinitou.test$WaitForLayout.run (test.java:82)
  at android.os.Handler.handleCallback (Handler.java:873)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:201)
  at android.app.ActivityThread.main (ActivityThread.java:6810)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:547)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:873)
These errors I think they are from starter service. All SQL variables and two maps are "dimed" at global process and initialized at service create of starter service. I use latest version of b4a and unfortunately I can't reproduce this error at my own devices that running Android 9.
Any ideas.
 

KMatle

Expert
Licensed User
Hard to say. I assume you have all the code in an Activity which is problematic. Use Activities for UI stuff only. The rest belongs to services.

As a first step I would move all (I really mean ALL) of the SQL code to a service and take care to handle all the important events like service destroy (use it to close the SQL conection with "SQL1.Close". This prevents corruption and other bad things.
 
Top