java.lang.ClassNotFoundException: Did not find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList

0

Good evening. Does anyone know how to solve this problem?

11-14 17:40:57.910 2110-2110/? E/AndroidRuntime: FATAL EXCEPTION: main
                                             Process: br.com.appvis.appvis, PID: 2110
                                             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/br.com.appvis.appvis-2.apk"],nativeLibraryDirectories=[/data/app-lib/br.com.appvis.appvis-2, /system/lib]]
                                                 at android.app.ActivityThread.installProvider(ActivityThread.java:4793)
                                                 at android.app.ActivityThread.installContentProviders(ActivityThread.java:4385)
                                                 at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4325)
                                                 at android.app.ActivityThread.access$1500(ActivityThread.java:135)
                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                 at android.os.Looper.loop(Looper.java:136)
                                                 at android.app.ActivityThread.main(ActivityThread.java:5017)
                                                 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:779)
                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
                                                 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/br.com.appvis.appvis-2.apk"],nativeLibraryDirectories=[/data/app-lib/br.com.appvis.appvis-2, /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:4778)
                                                 at android.app.ActivityThread.installContentProviders(ActivityThread.java:4385) 
                                                 at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4325) 
                                                 at android.app.ActivityThread.access$1500(ActivityThread.java:135) 
                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
                                                 at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                 at android.os.Looper.loop(Looper.java:136) 
                                                 at android.app.ActivityThread.main(ActivityThread.java:5017) 
                                                 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:779) 
                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                                                 at dalvik.system.NativeStart.main(Native Method) 

This error happens with some versions of Android. I tested it with Android 6.0 and Android 5.0 and did not make a mistake. But I went to test with Kit Kat and some phones of the Moto G1 gave error.

Look at the build.Gradle

apply plugin: 'com.android.application'

android {     compileSdkVersion 24     buildToolsVersion "24.0.1"

defaultConfig {
    applicationId "br.com.appvis.appvis"
    minSdkVersion 16
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies {

testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.google.firebase:firebase-ads:9.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:multidex:1.0.1'
compile 'org.parceler:parceler:1.0.3'
compile 'org.parceler:parceler-api:1.0.3'
compile 'br.com.livroandroid:android-utils:1.0.5'

}

    
asked by anonymous 14.11.2016 / 23:56

1 answer

1

I saw that you have already enabled MultiDex, so to complement, you should create a class and make a extends in the Application class of the package android.app and call the install method of the Multidex class by passing its context.

public class MyApplication extends Application {

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }
}

Once this is done, go to AndroidManifest.xml and change or enter the following line:

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

For the dependencies, I saw that it appears to be using the milk book, right?

    
13.01.2017 / 18:12