Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList

23,981 views
Skip to first unread message

Наталья Волохова

unread,
Dec 14, 2016, 11:12:09 AM12/14/16
to Firebase Google Group
Hi! I have a problem on devices on Android 4.x
When version of Android upper then 5.x this problem don't appears.

This is stack trace of my error:

java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.nata.volokhova.selfvocabuary-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.nata.volokhova.selfvocabuary-1, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:5121)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4713)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4596)
at android.app.ActivityThread.access$1600(ActivityThread.java:169)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5487)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.nata.volokhova.selfvocabuary-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.nata.volokhova.selfvocabuary-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.ActivityThread.installProvider(ActivityThread.java:5106)
... 12 more


This is build.gradle


apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.0"

defaultConfig {
applicationId "com.nata.volokhova.selfvocabuary"
minSdkVersion 16
targetSdkVersion 25
multiDexEnabled = true
versionCode 10
versionName "1.5.3"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

packagingOptions {
exclude 'LICENSE.txt'
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.google.android.gms:play-services:10.0.0'
// Dependency for Google Sign-In
compile 'com.google.android.gms:play-services-auth:10.0.0'
// Dependency for AdMob
compile 'com.google.firebase:firebase-ads:9.6.1'
//Dependency for Real-time Database
compile 'com.google.firebase:firebase-database:9.6.1'
}

apply plugin: 'com.google.gms.google-services'


Pleeese, help me!!! This problem breaks my world! :(

Rivaldy Firmansyah

unread,
May 18, 2017, 3:05:06 PM5/18/17
to Firebase Google Group

Ian Barber

unread,
May 19, 2017, 2:04:30 PM5/19/17
to Firebase Google Group
In this case, the issue is you're mixing different version of the Google Play services SDK, but I appreciate its not obvious! Update your version for play-services and firebase to match, e.g.

    compile 'com.google.android.gms:play-services-auth:10.0.0'
    // Dependency for AdMob
    compile 'com.google.firebase:firebase-ads:10.0.0'

Everything com.google.firebase and com.google.android.gms actually comes from the same package, and the mismatch here is causing the odd error. Fix the versions to be consistent and you should be fine!

Ian 

Vishalpari Goswami

unread,
Jul 23, 2017, 8:50:36 PM7/23/17
to Firebase Google Group

just put below lines in your project AndroidManifest.xml file if they're not

in application tag

<meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
 

Shahzad Ahmad

unread,
Nov 13, 2017, 10:39:17 AM11/13/17
to Firebase Google Group
 want to know more then click on the following link. https://stackoverflow.com/a/47265701/6672577.  
hopefully, it will work for you.

 1: Go to the gradle enable multiDexEnabled and add multidex library in the dependencies.

android {
   ...
   defaultConfig {
      multiDexEnabled true
      ...
   }
}

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

2: Go to the Manifest file and write android:name=".MyApplication" (Class name(MyApplication) is optional you can write whatever you want ).

    <application
        android:name=".MyApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        .
        .
        .
        .
        .
    </application>

  3: As you wrote android:name=".MyApplication" Inside Application at Manifest file. it will give you an error because you didn't create MyApplication class. Create MyApplication Class extend it by "application" class or Simply click on.MyApplication, a small red balloon appear on the left side of a syntax click on it, you will see (create MyApplication class) in the menu, click on it and Include below Method Inside that class.

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

 If you want to know more then Click on this Link:[https://developer.android.com/studio/build/multidex.html]

Anil Reddy

unread,
Feb 22, 2019, 10:39:36 AM2/22/19
to Firebase Google Group
public class YourApplication extends Application {

    @Override
    protected void attachBaseContext(Context context) {
        super.attachBaseContext(context);
        MultiDex.install(this);
    }
    @Override
    public void onCreate() {
        super.onCreate();
        Realm.init(this); //initialize other plugins 

    }
}
Add the above code it's working for me

On Wednesday, December 14, 2016 at 9:42:09 PM UTC+5:30, Наталья Волохова wrote:
On Wednesday, December 14, 2016 at 9:42:09 PM UTC+5:30, Наталья Волохова wrote:
Reply all
Reply to author
Forward
0 new messages