From caa9df86bcb3d20ea23f6405facd94f93d1a09fa Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Fri, 7 Jun 2019 00:17:00 -0700 Subject: [PATCH] Switch to R8 friendly room-runtime --- app/build.gradle | 8 ++++++++ app/src/main/java/com/topjohnwu/magisk/App.kt | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index 54786f878..c8e9fca18 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -90,6 +90,14 @@ dependencies { implementation "se.ansman.kotshi:api:${vKotshi}" kapt "se.ansman.kotshi:compiler:${vKotshi}" + modules { + module('androidx.room:room-runtime') { + replacedBy('com.github.topjohnwu:room-runtime') + } + } + def vRoom = "2.1.0-rc01" + implementation "com.github.topjohnwu:room-runtime:${vRoom}" + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.browser:browser:1.0.0' implementation 'androidx.preference:preference:1.0.0' diff --git a/app/src/main/java/com/topjohnwu/magisk/App.kt b/app/src/main/java/com/topjohnwu/magisk/App.kt index a82606e3d..1feb6d8a1 100644 --- a/app/src/main/java/com/topjohnwu/magisk/App.kt +++ b/app/src/main/java/com/topjohnwu/magisk/App.kt @@ -10,6 +10,9 @@ import android.os.Build import android.os.Bundle import androidx.appcompat.app.AppCompatDelegate import androidx.multidex.MultiDex +import androidx.room.Room +import androidx.work.impl.WorkDatabase +import androidx.work.impl.WorkDatabase_Impl import com.topjohnwu.magisk.di.koinModules import com.topjohnwu.magisk.utils.LocaleManager import com.topjohnwu.magisk.utils.RootUtils @@ -107,6 +110,12 @@ open class App : Application(), Application.ActivityLifecycleCallbacks { Shell.Config.addInitializers(RootUtils::class.java) Shell.Config.setTimeout(2) THREAD_POOL = AsyncTask.THREAD_POOL_EXECUTOR as ThreadPoolExecutor + Room.setFactory { + when (it) { + WorkDatabase::class.java -> WorkDatabase_Impl() + else -> null + } + } } @Deprecated("")