我的应用程序在启动时崩溃(java.lang.RuntimeException:无法获取提供程序)

时间:2018-06-10 20:34:56

标签: android crash android-multidex

我的应用程序从上周开始运行良好,但今天它已在启动时使用相同的代码崩溃。 我上周没有改变代码。 我不知道为什么会这样。 请尽快帮助我。

LogCat错误

06-11 00:53:19.400 9515-9515/? E/AndroidRuntime: FATAL EXCEPTION: main
                                             Process: com.jaffteach.medicare, PID: 9515
                                             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.jaffteach.medicare-yxLqDL7JptwmV2rJYJClrA==/base.apk", zip file "/data/app/com.jaffteach.medicare-yxLqDL7JptwmV2rJYJClrA==/split_lib_slice_0_apk.apk", zip file "/data/app/com.jaffteach.medicare-yxLqDL7JptwmV2rJYJClrA==/split_lib_slice_1_apk.apk", zip file "/data/app/com.jaffteach.medicare-yxLqDL7JptwmV2rJYJClrA==/split_lib_slice_2_apk.apk", zip file "/data/app/com.jaffteach.medicare-yxLqDL7JptwmV2rJYJClrA==/split_lib_slice_3_apk.apk", zip file "/data/app/com.jaffteach.medicare-yxLqDL7JptwmV2rJYJClrA==/split_lib_slice_4_apk.apk", zip file "/data/app/com.jaffteach.medicare-yxLqDL7JptwmV2rJYJClrA==/split_lib_slice_5_apk.apk", zip file "/data/app/com.jaffteach.medicare-yxLqDL7JptwmV2rJYJClrA==/split_lib_slice_6_apk.apk", zip file "/data/app/com.jaffteach.medicare-yxLqDL7JptwmV2rJYJClrA==/split_lib_slice_7_apk.apk", zip file "/data/app/com.jaffteach.medicare-yxLqDL7JptwmV2rJYJClrA==/split_lib_slice_8_apk.apk"],nativeLibraryDirectories=[/data/app/com.jaffteach.medicare-yxLqDL7JptwmV2rJYJClrA==/lib/x86, /system/lib, /vendor/lib]]
                                                 at android.app.ActivityThread.installProvider(ActivityThread.java:6288)
                                                 at android.app.ActivityThread.installContentProviders(ActivityThread.java:5851)
                                                 at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5772)
                                                 at android.app.ActivityThread.-wrap1(Unknown Source:0)
                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
                                                 at android.os.Handler.dispatchMessage(Handler.java:105)
                                                 at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6541)
                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                 at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)

Gradle:app

我的gradle是

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.jaffteach.medicare"
        minSdkVersion 20
        targetSdkVersion 26
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    useLibrary 'org.apache.http.legacy'
}
subprojects {
    afterEvaluate {
        project ->
            if (project.hasProperty("android")) {
                android {
                    compileSdkVersion 26 buildToolsVersion '26.0.2'
                }
            }
    }
}
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.0.0'
            }
        }
    }
}

请告诉我这个问题的最佳解决方案。

1 个答案:

答案 0 :(得分:1)

<强>最后 我搜索了很多,现在为我工作的解决方案是

  

禁用即时运行

禁用即时运行

简单到

  
      
  1. 设置

  2.   
  3. 构建,执行,部署

  4.   
  5. 即时运行

  6.   
  7. 并取消选中启用即时运行

  8.