Android Question Can not open Sqlite DataBase after upgrading Android 8.0

junaidahmed

Well-Known Member
Licensed User
Longtime User
I hava an Sqlite android application.It was working fine,after upgrading Android 8.0 ,I can not able to read SQlite DB from "/mnt/sdcard".

Note:-

When I Open and click "/mnt/sdcard/" from Thrid Party "Es File Explorer" ,then I can read SQliteDB from "/mnt/sdcard"....
 

junaidahmed

Well-Known Member
Licensed User
Longtime User
Please check the error log

B4X:
Dim ConKha As SQL
Dim TmpRst As Cursor
ConKha.Initialize(File.DirRootExternal & "/DataDir/Data/" ,"Config.S3db",True)
Error occurred on line: 190 (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:214)
at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:198)
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:836)
at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:821)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:714)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:689)
at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:44)
at com.cabinet.main._activity_create(main.java:571)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at com.cabinet.main.afterFirstLayout(main.java:104)
at com.cabinet.main.access$000(main.java:17)
at com.cabinet.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5624)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
** Activity (main) Resume **
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
ARE you using Runtimepermissions? File.Dirrootexternal requires it starting from api 23.
 
Upvote 0

junaidahmed

Well-Known Member
Licensed User
Longtime User
Please check my manifest file..

where I have to add "RunTimePermissions" ???
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="4"  android:targetSdkVersion="14" />
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>
    <activity android:name="com.config"></activity>     
    )
        
    
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetActivityAttribute(Main,android:windowSoftInputMode, "stateHidden|adjustPan")
'End of default text.
SetApplicationAttribute(android:theme, "@style/LightTheme")
CreateResource(values-v20, theme.xml,
<resources>
  <style
  name="LightTheme" parent="@android:style/Theme.Material.Light">
  </style>
</resources>
)
CreateResource(values-v14, theme.xml,
<resources>
  <style
  name="LightTheme" parent="@android:style/Theme.Holo.Light">
  </style>
</resources>
)
 
Upvote 0
Top