Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: - Android

Every time I'm using this library, I've got this error... This happens when I save my work then when I reopened it, this error happens... I've got this working on one of them so I just state all the tips that I tried.

TIPS 1 - Disabling Instant Run

In Android Studio 3.5.1, there is no Instant Run item in the Build, Execution, Deployment section.

I've check this but in Android studio there's no Instant Run I think it was merged in some feature, not sure.

TIP 2 - Rebuild and clean everything

Build -> make Projects
Build -> clean projects
File -> Invalidate Caches / Restart

Sometimes this is another good way to refresh the project it self.

TIP 3 - Adding to ProGuard

If you have applied proguard rules then add below line in ProGuard Rules

-keep class com.google.firebase.provider.FirebaseInitProvider

TIP 4 - Adding Multidex

Adding to Gradle

def multidex_version = "2.0.1"implementation "androidx.multidex:multidex:$multidex_version"

Add to manifest

android:name="androidx.multidex.MultiDexApplication"

Add to Activity

@Override
  protected void attachBaseContext(Context base) {
     super.attachBaseContext(base);
     MultiDex.install(this);
  }

TIP 5 - add to gradle

android {
    buildTypes {
        release {
            multiDexKeepFile file('multidex-config.txt')
            ...
        }
    }
}
multidex-config.txt (in the same directory as the build.gradle file)

Subscribe to You Live What You Learn

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe