TSR
TSR

Reputation: 20396

Didn't find class "com.google.firebase.provider.FirebaseInitProvider"

Before, my program run well. But When I just updated my Android studio to the latest version (2.2 built on 15-sept-16), I am having the following error. When I built it, it says: Built sucessfully, but this error appears when I run my program:

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.androidtutorial, PID: 28293 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.example.androidtutorial-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.androidtutorial-2/lib/x86, /system/lib, /vendor/lib]] at android.app.ActivityThread.installProvider(ActivityThread.java:5814) at android.app.ActivityThread.installContentProviders(ActivityThread.java:5403) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5342) at android.app.ActivityThread.-wrap2(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.example.androidtutorial-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.androidtutorial-2/lib/x86, /system/lib, /vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:380) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at android.app.ActivityThread.installProvider(ActivityThread.java:5799) at android.app.ActivityThread.installContentProviders(ActivityThread.java:5403)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5342)  at android.app.ActivityThread.-wrap2(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:6077)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

I already looked at other questions but the problem is not the same. What am I doing wrong? Please help

Upvotes: 11

Views: 20877

Answers (8)

Parinda Rajapaksha
Parinda Rajapaksha

Reputation: 3109

Add following line to Manifest.xml

 <application
    android:name="android.support.multidex.MultiDexApplication"

Add this sn App level build.gradle file

 defaultConfig {
    multiDexEnabled true
} 
      ......

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

Upvotes: 0

Zubair Akber
Zubair Akber

Reputation: 2828

A simple solution that works for me after trying all of these solution is by deleting outputs folder under project\app\build\ and rebuilding project will let it to running state.

Upvotes: 0

pruthwiraj.kadam
pruthwiraj.kadam

Reputation: 1093

app=>build.gradle

android {
.....
defaultConfig {
......
 multiDexEnabled true//add this line
}
......
dependencies{
 compile 'com.android.support:multidex:1.0.1'//add this line
}

In manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
....
<application
....
 android:name="android.support.multidex.MultiDexApplication" 
...>
 <activity   />
...

</application>

</manifest>

Upvotes: 2

akitsme
akitsme

Reputation: 45

just remove the google play services dependencies if you are including it. I am able to fix this error everytime using this. If you are using google maps or any other specific google service then include the dependency for that particular service only. Also try to check the version of google play service dependency.

Upvotes: 2

Chi Minh Trinh
Chi Minh Trinh

Reputation: 296

It seems you have a problem with Over 64K Methods and then tried to resolved it with multiDexEnabled true in build.gradle (app module). But you need to add more than:

  1. add: compile 'com.android.support:multidex:1.0.0' in dependencies of build.gradle

  2. Extends your Application class to MultiDexApplication. and add MultiDex.install(this); in onCreated method of Application class.

your issue should be resolved

refer link: https://developer.android.com/studio/build/multidex.html

Upvotes: 10

Kail D
Kail D

Reputation: 127

This works great which you add multidex support in manifest, when ever i encounter problem i got it fixed this way more over 64K.

<?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>

Upvotes: 2

Vaibhav Jain
Vaibhav Jain

Reputation: 163

I got the same error and resolved it using:

  1. Clean/Rebuild your Project.
  2. Restart Android Studio.
  3. Update all SDK tools and Android Studio.
  4. Clear Cache and Clear Data on Device.

Upvotes: 0

user6889641
user6889641

Reputation:

I got the same error. I resolved it by :

1) Removing unnecessary packages in the build.gralde.

2) Disabling the Firebase plugin

3) Upgrading the build tool to the latest

Upvotes: 0

Related Questions