Android Question Can not open Sqlite DataBase

junaidahmed

Well-Known Member
Licensed User
I have Developed MediaPlayer PlayList application (with Sqlite Database).It works fine Android 5.1 but when I run this same application in Android 7.1.2,It shows an error message "Can not Open Sqlite DataBase"..Please check below Log and download my project with SQlite Data from dropbox link

https://www.dropbox.com/s/9dyukkns8my15af/PlayList.zip?dl=0


Logger connected to: Xiaomi Redmi 4
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
main_activity_pause (java line: 479)
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.media.MediaPlayer.isPlaying()' on a null object reference
at anywheresoftware.b4a.objects.MediaPlayerWrapper.IsPlaying(MediaPlayerWrapper.java:155)
at com.playlist.main._activity_pause(main.java:479)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:186)
at com.playlist.main.onPause(main.java:271)
at android.app.Activity.performPause(Activity.java:7013)
at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1323)
at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:3791)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3768)
at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3742)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3716)
at android.app.ActivityThread.-wrap16(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6205)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 62 (Main)
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:808)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:793)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:696)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:671)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:755)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:345)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at com.playlist.main.afterFirstLayout(main.java:104)
at com.playlist.main.access$000(main.java:17)
at com.playlist.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6205)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
** Activity (main) Resume **
** Service (starter) Destroy **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
 

Mahares

Expert
Licensed User
shows an error message "Can not Open Sqlite DataBase"

1. You wanted members to test your project, but you do not include any of your databases with the project. That is not possible.
2. You are using File.DirRootExternal with a targect SDK of 26 in your manifest. You must use RunTimePermission as pointed out to you by @KMatle
3. In the meantime, you can try to run it by lowering your targetSDK to 19 or 22 and leave things as they are. You may have to uninstall the app first as you will be going from target 26 to 19 or 22. It will probably work for you.
 
Last edited:
Upvote 0
Top