0

Unable to get provider com.google.firebase.provider.FirebaseInitProvider: to run the project due to this error . How do I go about it? Please help.

10-08 15:05:05.957 17562-17562/com.coretec.msacco E/AndroidRuntime: FATAL EXCEPTION: main Process: com.coretec.msacco, PID: 17562 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.coretec.msacco-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.coretec.msacco-2, /vendor/lib, /system/lib]] at android.app.ActivityThread.installProvider(ActivityThread.java:5055) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4626) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4566) at android.app.ActivityThread.access$1500(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:5336) 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:828) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644) 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.coretec.msacco-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.coretec.msacco-2, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:497) at java.lang.ClassLoader.loadClass(ClassLoader.java:457) at android.app.ActivityThread.installProvider(ActivityThread.java:5040) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4626)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4566)  at android.app.ActivityThread.access$1500(ActivityThread.java:151)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)  at android.os.Handler.dispatchMessage(Handler.java:110)  at android.os.Looper.loop(Looper.java:193)  at android.app.ActivityThread.main(ActivityThread.java:5336)  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:828)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)  at dalvik.system.NativeStart.main(Native Method)  
1
  • 1
    Did you using MultiDex true in build.gradle.? Commented Oct 8, 2016 at 14:01

2 Answers 2

5

Avoid using play-services as whole in your gradle file. compile 'com.google.android.gms:play-services:9.8.0' instead use specific ones compile 'com.google.android.gms:play-services-location:9.8.0'

Sign up to request clarification or add additional context in comments.

Comments

1

Configure your app for multidex

  1. Modify the module-level build.gradle file to enable multidex and add the multidex library as a dependency, as shown here:

    android { defaultConfig { ... minSdkVersion 15 targetSdkVersion 28 multiDexEnabled true } ... } dependencies { implementation "androidx.multidex:multidex:2.0.1" } 
  2. Depending on whether you override the Application class, perform one of the following:

    If you do not override the Application class, edit your manifest file to set android:name in the tag as follows:

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

If you do override the Application class, change it to extend MultiDexApplication (if possible) as follows:

public class MyApplication extends MultiDexApplication { ... }

Or if you do override the Application class but it's not possible to change the base class, then you can instead override the attachBaseContext() method and callMultiDex.install(this) to enable multidex:

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

Caution: Do not execute MultiDex.install() or any other code through reflection or JNI before MultiDex.install() is complete. Multidex tracing will not follow those calls, causing ClassNotFoundException or verify errors due to a bad class partition between DEX files.

source

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.