Android Question KeyValueStore problem with some devices

Discussion in 'Android Questions' started by Arf, Feb 23, 2015.

  1. Arf

    Arf Active Member Licensed User

    I use KeyValueStore to store some configuration values in my app, but I see I have received some ANR's recently, the Cause listed as follows:

    Caused by: java.lang.RuntimeException: android.database.sqlite.SQLiteException: unable to open database file

    Device: ALCATEL ONE TOUCH 4010X (Beetle_Lite_GSM)
    Android: Android 2.3.3 - 2.3.7

    Is there a minimum android version that KeyValueStore/Sql is to be used with?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    There is no minimum version. Maybe there was not enough space for the file to be created.
     
  3. Arf

    Arf Active Member Licensed User

    thanks Erel.
    I've pasted more of the ANR below (this is a slightly different ANR that I received this morning):
    Caused by: 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:804)
    at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
    at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
    at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:669)
    at anywheresoftware.b4a.sql.SQL.Initialize(SQL.java:37)

    Is there any way I can catch this exception and suppress any errors, and proceed without using the KeyValueStore functionality?
     
  4. Cableguy

    Cableguy Expert Licensed User

    Use a try catch block when trying to open the Database... if it errors out load defaults... KeyValueStore has a method to retrieve a value from a given key and if the value(or key?) is not present assume a default value
     
    Peter Simpson likes this.
  5. Erel

    Erel Administrator Staff Member Licensed User

    This error happens in SQL.Initialize call inside KeyValueStore class. This is the place where you need to add the Try / Catch block.
     
    Peter Simpson likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice