Android Question App compiles without error but doesn't start on device

brodmuehler

Member
Licensed User
Longtime User
Dear All
I have a project on which I am working since some time now and developed it to various versions. I have a version on my smartphone which functions properly and per design that I created with the old SDK/JDK setup. I now installed the new environment as per the instructions and now the app is failing.

When I now take my latest version of the project that properly runs and functions on my smartphone and try to re-install it, then the following happens:
  • No change to the code after I changed from the old IDE to the new IDE
  • The project compiles without any errors
  • I can install the project on my smartphone
  • But when I start the app, it crashes straight away. It tries to open and then immediately fails.
Unfortunately, I am not getting any report in B4A. And I don't know if my smarphone creates any failure reports. If so, I certainly don't know where to look for this report. I am using a Samsung S10 with Android 11. Btw, I am using the S10 just for dev purposes. This is not my regular phone. My regular phone is a S20 with Android 12.

In a nutshell: I installed my app from the old IDE on my S20 and it runs as per intend. I installed my app on the S10 from the old IDE and it worked. I now reinstalled the same app on my S10 from the new IDE and the app fails.

Could someone please help me to find out what my mistake is. This app is pretty important for me and I would like to further improve it.
Any idea?
Your help is highly appreciated.
Cheers
René
 

asales

Expert
Licensed User
Longtime User
Did you check the unfiltered logs in IDE?
At the bottom left of the Log tab is a tick-box labelled "Filter".
 
Upvote 0

MikeSW17

Active Member
Licensed User
Longtime User
As you've just upgraded to B4A v11.2 and it worked before, I suspect there is a problem with the download, installation and/or configuration.
What happens if you try and run the "SDK Manager"? (if it works just exit - DON'T do any 'recommended' updates)
 
Upvote 0

brodmuehler

Member
Licensed User
Longtime User
I got these failure messages. Looks to me that the app cannot read my sqlite file anymore. But what changed?
The log is saying that the file is not readable, but I haven't changed anything.

Logger verbunden mit: samsung SM-G973F
--------- beginning of crash
--------- beginning of system
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 578)
android.database.sqlite.SQLiteCantOpenDatabaseException: Cannot open database '/storage/emulated/0/gliderlog/gliderlog.sqlite': File /storage/emulated/0/gliderlog/gliderlog.sqlite is not readable
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:365)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:226)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1392)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1337)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1007)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:946)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
at b4a.gliderlog.main._activity_create(main.java:578)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at b4a.gliderlog.main.afterFirstLayout(main.java:105)
at b4a.gliderlog.main.access$000(main.java:17)
at b4a.gliderlog.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8595)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 2062 SQLITE_CANTOPEN_EACCES[2062]): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:337)
... 22 more
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 578)
android.database.sqlite.SQLiteCantOpenDatabaseException: Cannot open database '/storage/emulated/0/gliderlog/gliderlog.sqlite': File /storage/emulated/0/gliderlog/gliderlog.sqlite is not readable
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:365)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:226)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1392)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1337)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1007)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:946)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
at b4a.gliderlog.main._activity_create(main.java:578)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at b4a.gliderlog.main.afterFirstLayout(main.java:105)
at b4a.gliderlog.main.access$000(main.java:17)
at b4a.gliderlog.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8595)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 2062 SQLITE_CANTOPEN_EACCES[2062]): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:337)
... 22 more
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 578)
android.database.sqlite.SQLiteCantOpenDatabaseException: Cannot open database '/storage/emulated/0/gliderlog/gliderlog.sqlite': File /storage/emulated/0/gliderlog/gliderlog.sqlite is not readable
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:365)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:226)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1392)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1337)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1007)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:946)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
at b4a.gliderlog.main._activity_create(main.java:578)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at b4a.gliderlog.main.afterFirstLayout(main.java:105)
at b4a.gliderlog.main.access$000(main.java:17)
at b4a.gliderlog.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8595)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 2062 SQLITE_CANTOPEN_EACCES[2062]): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:337)
... 22 more
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 578)
android.database.sqlite.SQLiteCantOpenDatabaseException: Cannot open database '/storage/emulated/0/gliderlog/gliderlog.sqlite': File /storage/emulated/0/gliderlog/gliderlog.sqlite is not readable
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:365)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:226)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1392)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1337)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1007)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:946)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
at b4a.gliderlog.main._activity_create(main.java:578)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at b4a.gliderlog.main.afterFirstLayout(main.java:105)
at b4a.gliderlog.main.access$000(main.java:17)
at b4a.gliderlog.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8595)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 2062 SQLITE_CANTOPEN_EACCES[2062]): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:337)
... 22 more
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 578)
android.database.sqlite.SQLiteCantOpenDatabaseException: Cannot open database '/storage/emulated/0/gliderlog/gliderlog.sqlite': File /storage/emulated/0/gliderlog/gliderlog.sqlite is not readable
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:365)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:226)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1392)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1337)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1007)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:946)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
at b4a.gliderlog.main._activity_create(main.java:578)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at b4a.gliderlog.main.afterFirstLayout(main.java:105)
at b4a.gliderlog.main.access$000(main.java:17)
at b4a.gliderlog.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8595)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 2062 SQLITE_CANTOPEN_EACCES[2062]): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:337)
... 22 more
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 578)
android.database.sqlite.SQLiteCantOpenDatabaseException: Cannot open database '/storage/emulated/0/gliderlog/gliderlog.sqlite': File /storage/emulated/0/gliderlog/gliderlog.sqlite is not readable
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:365)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:226)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1392)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1337)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1007)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:946)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
at b4a.gliderlog.main._activity_create(main.java:578)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at b4a.gliderlog.main.afterFirstLayout(main.java:105)
at b4a.gliderlog.main.access$000(main.java:17)
at b4a.gliderlog.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8595)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 2062 SQLITE_CANTOPEN_EACCES[2062]): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:337)
... 22 more
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 578)
android.database.sqlite.SQLiteCantOpenDatabaseException: Cannot open database '/storage/emulated/0/gliderlog/gliderlog.sqlite': File /storage/emulated/0/gliderlog/gliderlog.sqlite is not readable
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:365)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:226)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1392)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1337)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1007)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:946)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
at b4a.gliderlog.main._activity_create(main.java:578)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at b4a.gliderlog.main.afterFirstLayout(main.java:105)
at b4a.gliderlog.main.access$000(main.java:17)
at b4a.gliderlog.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8595)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 2062 SQLITE_CANTOPEN_EACCES[2062]): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:337)
... 22 more
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 84 (Main)
android.database.sqlite.SQLiteCantOpenDatabaseException: Cannot open database '/storage/emulated/0/gliderlog/gliderlog.sqlite': File /storage/emulated/0/gliderlog/gliderlog.sqlite is not readable
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:365)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:226)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1392)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1337)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1007)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:946)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
at b4a.gliderlog.main._activity_create(main.java:733)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at b4a.gliderlog.main.afterFirstLayout(main.java:105)
at b4a.gliderlog.main.access$000(main.java:17)
at b4a.gliderlog.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8595)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 2062 SQLITE_CANTOPEN_EACCES[2062]): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:337)
... 26 more
** Activity (main) Resume **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 84 (Main)
android.database.sqlite.SQLiteCantOpenDatabaseException: Cannot open database '/storage/emulated/0/gliderlog/gliderlog.sqlite': File /storage/emulated/0/gliderlog/gliderlog.sqlite is not readable
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:365)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:226)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1392)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1337)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1007)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:946)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
at b4a.gliderlog.main._activity_create(main.java:733)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at b4a.gliderlog.main.afterFirstLayout(main.java:105)
at b4a.gliderlog.main.access$000(main.java:17)
at b4a.gliderlog.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8595)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 2062 SQLITE_CANTOPEN_EACCES[2062]): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:337)
... 26 more
** Activity (main) Resume **
java.lang.RuntimeException: Unable to create service b4a.gliderlog.starter: java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io_OutputStream.write(byte[])' on a null object reference
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4654)
at android.app.ActivityThread.access$1700(ActivityThread.java:301)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2177)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8595)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io_OutputStream.write(byte[])' on a null object reference
at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:164)
at anywheresoftware.b4a.shell.Shell.start(Shell.java:102)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:92)
at b4a.gliderlog.starter.onCreate(starter.java:34)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4642)
... 8 more
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void java.io_OutputStream.write(byte[])' on a null object reference
at anywheresoftware.b4a.shell.ShellConnector.sendControlMessage(ShellConnector.java:61)
at anywheresoftware.b4a.shell.Shell.virtualAssets(Shell.java:124)
... 12 more
Copying updated assets files (34)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Pause, UserClosed = false **
** Service (starter) Destroy (ignored)**
Service started in the background. Trying to start again in foreground mode.
*** Service (starter) Create ***
** Service (starter) Start **
Service started in foreground mode.
** Activity (main) Create, isFirst = true **
Error occurred on line: 84 (Main)
android.database.sqlite.SQLiteCantOpenDatabaseException: Cannot open database '/storage/emulated/0/gliderlog/gliderlog.sqlite': File /storage/emulated/0/gliderlog/gliderlog.sqlite is not readable
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:365)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:226)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1392)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1337)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1007)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:946)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
at b4a.gliderlog.main._activity_create(main.java:733)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at b4a.gliderlog.main.afterFirstLayout(main.java:105)
at b4a.gliderlog.main.access$000(main.java:17)
at b4a.gliderlog.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8595)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 2062 SQLITE_CANTOPEN_EACCES[2062]): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:337)
... 26 more
** Activity (main) Resume **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 84 (Main)
android.database.sqlite.SQLiteCantOpenDatabaseException: Cannot open database '/storage/emulated/0/gliderlog/gliderlog.sqlite': File /storage/emulated/0/gliderlog/gliderlog.sqlite is not readable
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:365)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:226)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:737)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:284)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:251)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1392)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1337)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1007)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:946)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
at b4a.gliderlog.main._activity_create(main.java:733)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at b4a.gliderlog.main.afterFirstLayout(main.java:105)
at b4a.gliderlog.main.access$000(main.java:17)
at b4a.gliderlog.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8595)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 2062 SQLITE_CANTOPEN_EACCES[2062]): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:337)
... 26 more
** Activity (main) Resume **
 
Upvote 0

brodmuehler

Member
Licensed User
Longtime User
It is the undelined code that causes the problem now. Looks like something is wrong with how I define the directory. Funny enough that it worked so far.

I don't want to store the database (gliderlog.sqlite) neither in my app directory nor on a SD card. I want to store it in that directoty I can easily access via an explorer. What is my mistake?

Thanks a lot.
Cheers
René

Dim SQL1 As SQL
Dim DBFileName As String : DBFileName = "gliderlog.sqlite"
Dim DBFileDir As String : DBFileDir = File.DirRootExternal & "/gliderlog"

If FirstTime Then
' initialize the database
If File.Exists(DBFileDir, DBFileName) = False Then
File.MakeDir(File.DirRootExternal, "gliderlog")
File.Copy(File.DirAssets, DBFileName, DBFileDir, DBFileName)
End If
SQL1.Initialize(DBFileDir, DBFileName, True)
End If
 
Upvote 0

asales

Expert
Licensed User
Longtime User
I don't want to store the database (gliderlog.sqlite) neither in my app directory nor on a SD card. I want to store it in that directoty I can easily access via an explorer.
And Google don't want you do this.

You will find several posts in the forum about the new restrictions in the SDK 30.

And check this too:
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
but I haven't changed anything.
But you have! You've probably upped the target SDK number.As @asales indicates, this is the problem

File.MakeDir(File.DirRootExternal, "gliderlog")

You can no longer directly access the file system

If your app doesn't need to go in the Play Store you can keep the present behaviour by targeting SDK 28 using the PERMISSION_WRITE_EXTERNAL_STORAGE permission or by using the MANAGE_EXTERNAL_STORAGE permission and targeting SDK 30.
 
Last edited:
Upvote 0

brodmuehler

Member
Licensed User
Longtime User
Dear All

thankls a lot for all the good input. I will try you suggestion and see whats happening. I actually thought about putting the app in the Paystore at some time so it would be great to have a solution that works there as well.

For now ... many thanks and I give this a go.
Gratefully
Rene
 
Upvote 0

brodmuehler

Member
Licensed User
Longtime User
Dear All

this is what I have in my manifest now ...

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="30"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>
    <uses-permission
  android:name="android.permission.WRITE_EXTERNAL_STORAGE"
  android:maxSdkVersion="18" />)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

With the following code lines I start my app and decide where my sqlite database willbe stored:

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("LayoutMain")
    
    If FirstTime Then
        ' initialize the database
        DBFileDir=DBUtils.CopyDBFromAssets(DBFileName)
        Log (DBFileDir)
        Log (DBFileName)
        SQL1.Initialize(DBFileDir, DBFileName, True)
    End If

Extract from DBUtils

Extract from DBUtils:
'Returns the path to a folder where you can create a database, preferably on the secondary storage.
Public Sub GetDBFolder As String
    Dim rp As RuntimePermissions
    If File.ExternalWritable Then Return rp.GetSafeDirDefaultExternal("") Else Return File.DirInternal
End Sub

'Copies a database file that was added in the Files tab. The database must be copied to a writable location.
'This method copies the database to the storage card. If the storage card is not available the file is copied to the internal folder.
'The target folder is returned.
'If the database file already exists then no copying is done.
Public Sub CopyDBFromAssets (FileName As String) As String
    Dim TargetDir As String = GetDBFolder
    
    If File.Exists(TargetDir, FileName) = False Then
        File.Copy(File.DirAssets, FileName, TargetDir, FileName)
    End If
    Return TargetDir
End Sub

That solved my problem that the app started crashing at launch. The database is now stored in Android/data/b4a.appname/files ...

I have to admit that I still not fully clear what the difference is between minSDKversion, targetSDKversion and maxSDKversion :-(

Perhaps this is a help for others as well...

Cheers Rene
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
I have to admit that I still not fully clear what the difference is between minSDKversion, targetSDKversion and maxSDKversion :-(

Short: Android developped and security was added. Google decided that with newer versions (higher sdk) restrictions are higher. With older versions/sdk e.g. it was possible to read/write sms which you don't really want as a user or your could read files, pics very easy. Imagine an "bad app" which steals all of your data.
 
Upvote 0
Top