MultiDex Error like "FirebaseInitProvider Error path Android"
“Unable to get provider com.google.firebase.provider.FirebaseInitProvider” Error path Android Solution
This error shows generally on api 19. We faced that problem with Firebase when run application below API 19(< 4.4.2) devices due to error of
Multidex.
We recommend that you first, add only firebase messaging or firebase crash instead of firebase core in gradle file. Using firebase core is unnecessary and will slow down the application. So maybe you do not need multidex. Anyway You can resolve the problem as follows;
Add depency and add multidex.install() in attachBaseContext.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
... | |
defaultConfig { | |
multiDexEnabled true | |
... | |
} | |
} | |
dependencies { | |
// add dependency | |
compile 'com.android.support:multidex:1.0.2' | |
} | |
// ADD THIS AT THE BOTTOM | |
apply plugin: 'com.google.gms.google-services' | |
// | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
if (BuildConfig.DEBUG) { | |
Timber.plant(new Timber.DebugTree()); | |
} else { | |
Timber.plant(new CrashSender()); | |
} | |
} | |
//Add MultiDex install in attachBaseContext | |
@Override | |
protected void attachBaseContext(Context context) { | |
super.attachBaseContext(context); | |
MultiDex.install(this); | |
} |
Yorumlar
Yorum Gönder