Android Notes 56

Android Notes 56 : How to Fix Exception java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider

Kuray Ogun
FreakyCoder Software Blog
1 min readFeb 1, 2017

--

Hey,

If you’re using Firebase Cloud Messaging (FCM) and your minimum API level is 19, you will face this exception in 4.4.2 +.

Step 1 : Dependencies

First of all, we need to add in our build.gradle file

// Multidex
compile 'com.android.support:multidex:1.0.1'

Step 2 : MultiDexEnabled

Add multiDexEnabled true in our build.gradle’s android part

defaultConfig {
multiDexEnabled true
}

Step 3 : BaseApplication Part

Override attachBaseContext function and install our MultiDex

public class BaseApplication extends Application {

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

}

Important Note : DO NOT forget to install MultiDex in attachBaseContext!

After all these parts done, you’re good to go!

If you have any question, ask me :)

--

--