Did not find class "com.google.firebase.provider.FirebaseInitProvider"

Before that, my program worked well. But when I just updated my Android studio to the latest version (2.2 built on 15-segment-16), I got the following error. When I built it, he says: "Built successfully, but this error appears when I run my program:

E / AndroidRuntime: FATAL EXCEPTION: main Process: com.example.androidtutorial, PID: 28293 java.lang.RuntimeException: cannot get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: could not find class "com. google.firebase.provider.FirebaseInitProvider "along the 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]] in android.app.ActivityThread.installProvider (ActivityThread.java:5814) in android.app.ActivityThread.installContentProviders (ActivityThread.javaβˆ—403) in android. app.ActivityThread.handleBindApplication (ActivityThread.java:53 42) at android.app.ActivityThread.-wrap2 (ActivityThread.java) in android.app.ActivityThread $ H.handleMessage (ActivityThread.java:1528) on android.os.Handler.dispatchMessage (Handler.java:102) on android .os.Looper.loop (Looper.java:154) at android.app.ActivityThread.main (ActivityThread.java:6077) in java.lang.reflect.Method.invoke (native method) in com.android.internal.os .ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:755) Called: java.lang.ClassNotFoundException: could not find the class "com.google.firebase.provider.FirebaseInitProvider" on the 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]] in dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:56) in java.lang.ClassLoader.loadClass (ClassLoader.javaIf80) in java.lang.ClassLoader.loadClass (ClassLoader.javahaps12) in android.app.ActivityThread.installProvider (ActivityThread.java:5799) in android.app.ActivityThread.installContentProviders (ActivityThread.java=403) in android.app.ActivityThread.handleBindApplication (ActivityThread.javaPoint342) at android.app. ActivityThread.-wrap2 (ActivityThread.java) in android.app.ActivityThread $ H.handleMessage (ActivityThread.java:1528) on android.os.Handler.dispatchMessage (Handler.java:102) on android.os.Looper.loop ( Looper.java:154) at android.app.ActivityThread.main (ActivityThread.java:6077) in java.lang.reflect.Method.invoke (native method) in com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.Java: 865) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:755)

I have already considered other issues, but the problem is not the same. What am I doing wrong? Please, help

+8
java android android-studio compiler-errors error-handling
source share
9 answers

In the build.gradle application module

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

Change the name in AndroidManifest.xml

 <application .... android:name=".MyApplication"> // ... </application> 

Contains file MyApplication.java

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

See the link for more details.

+15
source share

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

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

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

Your problem must be resolved.

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

+9
source share

This works great, and you add multidex support to the manifest, when I ever run into a problem, I decided that it was fixed 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> 
+2
source share

just remove the dependencies of the Google Play services if you enable them. I can fix this error every time using this. If you use Google maps or any other special google service, then enable dependency only for this specific service. Also try checking out the google play service dependency version.

+2
source share

application => 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> 
+2
source share

I got the same error. I resolved this:

1) Removing unnecessary packages in build.gralde.

2) Disabling the Firebase plugin

3) Update the build tool to the last

0
source share

I got the same error and resolved it using:

  • Clean / rebuild the project.
  • Restart Android Studio.
  • Update all SDK and Android Studio tools.
  • Clear cache and clear data on device.
0
source share

A simple solution that works for me after trying all these solutions is to delete the outputs in the project \ app \ build \ folder, and rebuilding the project will let it work state.

0
source share

Add the following line to Manifest.xml

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

Add this sn application level file build.gradle

  defaultConfig { multiDexEnabled true } ...... dependencies { compile 'com.android.support:multidex:1.0.1' } 
0
source share

All Articles