Didn't find class "com.google.firebase.provider.FirebaseInitProvider"?
I had the same error and I solved it with MultiDex, like described on this link : https://developer.android.com/studio/build/multidex.html
Sometimes it is not enough just to enable MultiDex.
If any class that's required during startup is not provided in the primary DEX file, then your app crashes with the error java.lang.NoClassDefFoundError. https://developer.android.com/studio/build/multidex#keep
FirebaseInitProvider is required during startup.
So you must manually specify FirebaseInitProvider as required in the primary DEX file.
build.gradle file
android {
buildTypes {
release {
multiDexKeepFile file('multidex-config.txt')
...
}
}
}
multidex-config.txt (in the same directory as the build.gradle file)
com/google/firebase/provider/FirebaseInitProvider.class
I too faced the same issue and finally solved it by disabling Instant Run
in an android studio.
Settings → Build, Execution, Deployment → Instant Run and uncheck Enable Instant Run
Update:
There is no Instant Run option available in latest Android Studio 3.5+. It should be applicable only for older versions.
In the build.gradle(Module:app) file, insert the code below into defaultConfig :
defaultConfig {
applicationId "com.***.****"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
and insert into to dependencies :
implementation 'com.android.support:multidex:2.0.1'
Then add code to manifest :
<application
android:name="android.support.multidex.MultiDexApplication"