.ClassNotFoundException:未在路径上找到“com.google.firebase.provider.FirebaseInitProvider”类:DexPathList

时间:2017-05-21 08:45:35

标签: android

当我将我的应用程序分享给其他人然后我的应用程序崩溃但是当我运行我的应用程序直接fron studio然后应用程序运行正常但我已经看到所有解决方案,但没有任何对我有用。

  

java.lang.RuntimeException:无法获取提供者   com.google.firebase.provider.FirebaseInitProvider:   java.lang.ClassNotFoundException:没找到类   路径上的“com.google.firebase.provider.FirebaseInitProvider”:   DexPathList [[zip文件   “/data/app/com.example.amit.workoutdocent-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.amit.workoutdocent-1/lib/arm,   / vendor / lib,/ system / lib]]                                                                                     在   android.app.ActivityThread.installProvider(ActivityThread.java:6948)                                                                                     在   android.app.ActivityThread.installContentProviders(ActivityThread.java:6540)                                                                                     在   android.app.ActivityThread.handleBindApplication(ActivityThread.java:6480)                                                                                     在android.app.ActivityThread.access $ 1800(ActivityThread.java:230)                                                                                     在   android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1888)                                                                                     在android.os.Handler.dispatchMessage(Handler.java:102)                                                                                     在android.os.Looper.loop(Looper.java:148)                                                                                     在android.app.ActivityThread.main(ActivityThread.java:7409)                                                                                     at java.lang.reflect.Method.invoke(Native Method)                                                                                     在   com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1230)                                                                                     在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)                                                                                  引起:java.lang.ClassNotFoundException:没找到类   路径上的“com.google.firebase.provider.FirebaseInitProvider”:   DexPathList [[zip文件   “/data/app/com.example.amit.workoutdocent-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.amit.workoutdocent-1/lib/arm,   / vendor / lib,/ system / lib]]                                                                                     在   dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)                                                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)                                                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:469)                                                                                     在   android.app.ActivityThread.installProvider(ActivityThread.java:6933)                                                                                     在   android.app.ActivityThread.installContentProviders(ActivityThread.java:6540)                                                                                     在   android.app.ActivityThread.handleBindApplication(ActivityThread.java:6480)                                                                                     在android.app.ActivityThread.access $ 1800(ActivityThread.java:230)                                                                                     在   android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1888)                                                                                     在android.os.Handler.dispatchMessage(Handler.java:102)                                                                                     在android.os.Looper.loop(Looper.java:148)                                                                                     在android.app.ActivityThread.main(ActivityThread.java:7409)                                                                                     at java.lang.reflect.Method.invoke(Native Method)                                                                                     在   com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1230)                                                                                     在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

4 个答案:

答案 0 :(得分:1)

在build.gradle文件中将我的gradle版本从2.3.3降低到2.3.0,清理并构建项目。现在工作正常。

答案 1 :(得分:1)

通过在Android Studio中禁用即时运行来解决

设置→构建,执行,部署→即时运行,并取消选中启用即时运行

答案 2 :(得分:0)

确保您的build.gradle中的Google Play服务和Firebase依赖版本相同。然后,在Android Studio中使用invalidate cache和restart选项

答案 3 :(得分:0)

如果你的minSdkVersion设置为20或更低,那么你必须使用multidex支持库:

module-level.gradle ---

android {
defaultConfig {
    ...
    minSdkVersion 15 
    targetSdkVersion 26
    multiDexEnabled true
}
...
}

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

并在您的Application类

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