0

I found a issue when i was using Android Room on devices with android version 7 or older.

The issue is printf function in sqlite3 has three-digit separator capability but this feature is not available in older version of library.

I decided to attach sqlite3 library to my application so my application will use certain version of sqlite3.

I followed instructions in SQLite Android Bindings and build aar file with my app. but i have to use org.sqlite.database.sqlite.SQLiteDatabase class to use sqlite library in AAR.

This is ok if write my own wrapper for sqlite access but when i am using Android Room is there any way to force Room to works with org.sqlite.database.sqlite.SQLiteDatabase instead of Android version.

H00man
  • 375
  • 1
  • 7
  • 21
  • [Builder.openHelperFactory](https://developer.android.com/reference/androidx/room/RoomDatabase.Builder#openHelperFactory(androidx.sqlite.db.SupportSQLiteOpenHelper.Factory)) ? I think this how you can use Room with SQLCipher for example – bwt Apr 09 '21 at 15:07
  • is there any implementation for that? or I have to implement it. – H00man Apr 09 '21 at 15:19
  • 1
    [How to install most recent version of Sqlite aar when using Room On Android](https://stackoverflow.com/a/65267351/1283554) ? – bwt Apr 12 '21 at 08:49

1 Answers1

0

There is an implementation (Thanks to bwt) for more detail

gradle file

dependencies {
    ...
    implementation 'io.requery:sqlite-android:3.34.1'
    ...
}

application class

 database = Room.databaseBuilder(context, MyDB.class, "app.db")
            ...
            .openHelperFactory(new RequerySQLiteOpenHelperFactory())
            ...
            .build();
 dao = database.getDao();
H00man
  • 375
  • 1
  • 7
  • 21