Didn't Find Class "Com.Google.Firebase.Provider.Firebaseinitprovider"

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

Unable find class com.google.firebase.provider.FirebaseInitProvider below API level 21

Did you try adding Multidex application class in your AndroidManifest.xml file?

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>

Add the following dependency:

dependencies {
compile 'com.android.support:multidex:1.0.1'
}

Read here for more information: Configure Apps with Over 64K Methods | Android Studio

How to fix android 4.4.2 error ClassNotFoundException: Didn't find class com.google.firebase.provider.FirebaseInitProvider on path: DexPathList

Note: If your project is configured for multidex with minSdkVersion 20 or lower, and you deploy to target devices running Android 4.4 (API level 20) or lower, Android Studio disables Instant Run.

When running on versions prior to Android 5.0 (API level 21), using multidex is not enough to work around the linearalloc limit (issue 78035). This limit was increased in Android 4.0 (API level 14), but that did not solve it completely. And on versions lower than Android 4.0, you might reach the linearalloc limit before reaching the DEX index limit. So if you are targeting API levels lower than 14, test thoroughly on those versions of the platform, because your app might have issues at startup or when particular groups of classes are loaded. Code shrinking can reduce or possibly eliminate these issues.

You have too many methods. There can only be 65536 methods for dex.

So, enable multidex as following:

android {    
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}

create one class like this

public class Multi_Dex extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}

now in your manifiest file add this

<application
android:name=".Multi_Dex"
android:allowBackup="true"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">

to solve this problem s, like described on this link : developer.android.com/studio/build/multidex

or try this my friend for kitkat or lower version

android {
defaultConfig {
...
multiDexEnabled true
}
productFlavors {
dev {
// Enable pre-dexing to produce an APK that can be tested on
// Android 5.0+ without the time-consuming DEX build processes.
minSdkVersion 21
}
prod {
// The actual minSdkVersion for the production version.
minSdkVersion 14
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}


Related Topics



Leave a reply



Submit