I have tried many solutions on this website but still, the problem is not solved. The issue is due to Android X library. When I added Android X, this issue was resolved but
I think you are migrating to AndroidX libs.
Add below lines to gradle.properties file
android.useAndroidX=true
android.enableJetifier=true
Remove tools:replace="android:appComponentFactory"
from manifest.
Replace android.support.v7.app.AppCompatActivity
to androidx.appcompat.app.AppCompatActivity
Migrating to AndroidX
migrate to android x
add below lines inside tag
tools:replace="android:appComponentFactory"
android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
then also add below lines inside gradle.properties file
android.useAndroidX=true
android.enableJetifier=true
Rebuild your project.
I got same error in my project, I have resolved it You can try it
Android Studio > Refactor > Migrate to AndroidX
You can try adding:
android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
To the tag <application >
in your manifest.
In my case, i was facing problem because of the firebase version i was using. Downgrading the firebase version helped me.
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' implementation 'com.google.firebase:firebase-core:16.0.6'
In my case, I had updated Firebase and play services dependency, result in this issue.
Reverted back the dependency updates and the error vanished
Seems that the latest Firebase and Play Service dependencies are compatible with androidx.