square / sqlbrite

A lightweight wrapper around SQLiteOpenHelper which introduces reactive stream semantics to SQL operations.

Home Page:https://square.github.io/sqlbrite/3.x/sqlbrite/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I hope this is updated with the sqlite support library of androidx

brownsoo opened this issue · comments

3.2 version works OK. but I hope this is updated with the sqlite support library of androidx.

Yes. Jetifier is sufficient. I mentioned this because just hinting the type mismatch error in IDE. It's not required issue.

import androidx.sqlite.db.SupportSQLiteDatabase
import androidx.sqlite.db.SupportSQLiteOpenHelper
import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
...
private var brite: BriteDatabase? = null
fun open() {
    // Type mismatch hinting in android studio IDE ----- //
    brite = sqlBrite().wrapDatabaseHelper(openHelper(context), Schedulers.io())  
}
private fun openHelper(context: Context): SupportSQLiteOpenHelper {
    val configuration = SupportSQLiteOpenHelper.Configuration.builder(context)
        .name(DB_NAME)
        .callback(DBCallback(DB_VERSION))
        .build()
    return FrameworkSQLiteOpenHelperFactory().create(configuration)
}

Did you invalidate caches and restart? Running jetifier is pretty damaging in terms of the IDE's cache and resetting it tends to fix these issues.

Gooood!! Thank ~~! You are the best!!