设置FIrebase云消息传递 - NoSuchMethodError:无静态方法zzb

时间:2017-02-06 18:26:39

标签: android firebase gradle firebase-cloud-messaging

我已将Firebase安装到我的项目中,并提供该错误。谁能告诉我,我做错了什么? logcat的:

    02-06 13:06:31.432 3489-3489/com.internship.droidz.talkin I/MultiDex: VM with version 2.1.0 has multidex support
02-06 13:06:31.432 3489-3489/com.internship.droidz.talkin I/MultiDex: install
02-06 13:06:31.432 3489-3489/com.internship.droidz.talkin I/MultiDex: VM has multidex support, MultiDex support library is disabled.
02-06 13:06:31.437 3489-3489/com.internship.droidz.talkin D/AndroidRuntime: Shutting down VM
02-06 13:06:31.438 3489-3489/com.internship.droidz.talkin E/AndroidRuntime: FATAL EXCEPTION: main
                                                                            Process: com.internship.droidz.talkin, PID: 3489
                                                                            java.lang.NoSuchMethodError: No static method zzb(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzac; or its super classes (declaration of 'com.google.android.gms.common.internal.zzac' appears in /data/app/com.internship.droidz.talkin-1/base.apk)
                                                                                at com.google.firebase.provider.FirebaseInitProvider.zza(Unknown Source)
                                                                                at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
                                                                                at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
                                                                                at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
                                                                                at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
                                                                                at android.app.ActivityThread.-wrap1(ActivityThread.java)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:148)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

build.gradle(app):

    dependencies {

...

    compile 'com.android.support:support-v4:25.1.0'

...

//Firebase
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
    ...
}

apply plugin: 'com.google.gms.google-services'

build.gradle(project):

    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'
    }
}

启用Multidex

我需要添加或更改内容?

1 个答案:

答案 0 :(得分:1)

在第一次必须清理并再次构建项目时安装multidex的时间。