Unable to get provider androidx.lifecycle.ProcessLifecycleOwnerInitializr
Thanks Andrews Alves
From post
It was a Dex problem. in android 4.4
1 - in app gradle, inside defaultConfig enable multidex
defaultConfig{
....
multiDexEnabled true
}
2 - to support multidex in other versions, add this dependency to your app gradle
implementation 'com.android.support:multidex:1.0.3'
3 - if you have a class that extends Application, make it extend
MultiDexApplication
if you don't, add this to your manifest file inside application tag
android:name="android.support.multidex.MultiDexApplication"
Besides, if you created a new application, dont forget to add the following to your app/build.gradle
android {
defaultConfig {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
that's it. worked for me
For kotlin add this to your gradle :
kotlinOptions {
jvmTarget = '1.8'
}
compileOptions {
targetCompatibility = "8"
sourceCompatibility = "8"
}
In my case, Somehow android architecture lifecycle files getting omitted with Android bundle on Pie(Android9). So what I did was added keep statement for the same in proguard-rules.pro
For AndroidX :
-keep class androidx.lifecycle.** {*;}
For Support :
-keep class android.arch.lifecycle.** {*;}