本文介绍了Firebase消息传递NoSuchMethodError.zzUr异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将FCM集成到android项目中,因为它是在中编写的。
我的应用程序的gradle:
依赖关系{
compile fileTree (包括:['* .jar'],dir:'libs')
testCompile'junit:junit:4.12'
...
compile'com.android.support:multidex: 1.0.0'
compile'com.android.support:support-v4:20.0.0'
compile'com.google.firebase:firebase-core:9.2.0'
compile' com.google.firebase:firebase-config:9.2.0'
compile'com.google.firebase:firebase-messaging:9.0.2'
compile'com.google.firebase:firebase-crash: 9.2.0'
compile'com.google.android.gms:play-services-ads:9.2.0'
compile'com.google.android.gms:play-services-analytics:9.2。 0'
compile'com.google.android.gms:play-services-games:9.2.0'
}
apply plugin:'com.google.gms.google -服务
Manifest.xml:
< service
android:name =。MyFirebaseMessagingService>
< intent-filter>
< action android:name =com.google.firebase.MESSAGING_EVENT/>
< / intent-filter>
< / service>
public class MyFirebaseMessagingService extends FirebaseMessagingService {
$ b $ @Override
public void onMessageReceived(RemoteMessage remoteMessage){
Log.i(info,From: + remoteMessage.getFrom());
Log.i(info,Notification Message Body:+ remoteMessage.getNotification()。getBody());
code
$ b $ p
$ b 但是,当我发送推,我得到的是:
java.lang.NoSuchMethodError:com.google.firebase.iid.FirebaseInstanceIdInternalReceiver .zzUr
在com.google.firebase.messaging.FirebaseMessagingService.zzz(未知来源)
在com.google.firebase.iid.zzb.onStartCommand(未知来源)
在android.app .ActivityThread.handleServiceArgs(ActivityThread.java:2805)
at android.app.ActivityThread.access $ 1900(ActivityThread.java:156)
at android.app.ActivityThread $ H.handleMessage(ActivityThread.java: 1437)
在android.os.Handler.dispatchMessage(Handler.java:99)
在android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native方法)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
不能谷歌它。有没有人遇到过它?尝试使用相同版本运行所有服务。在这种情况下,请更改:
compile'com.google.firebase:firebase-messaging:9.0.2'
到
编译'com.google.firebase:firebase-messaging:9.2.0'
并检查是否相同问题发生。
i am trying to integrate FCM to android project as it's written in Firebase documentation.
My app's gradle:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
...
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:support-v4:20.0.0'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-config:9.2.0'
compile 'com.google.firebase:firebase-messaging:9.0.2'
compile 'com.google.firebase:firebase-crash:9.2.0'
compile 'com.google.android.gms:play-services-ads:9.2.0'
compile 'com.google.android.gms:play-services-analytics:9.2.0'
compile 'com.google.android.gms:play-services-games:9.2.0'
}
apply plugin: 'com.google.gms.google-services'
Manifest.xml:
<service
android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
And MyFirebaseMesagingService:
public class MyFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.i("info", "From: " + remoteMessage.getFrom());
Log.i("info", "Notification Message Body: " + remoteMessage.getNotification().getBody());
}
}
But when i send push, what i get is:
java.lang.NoSuchMethodError: com.google.firebase.iid.FirebaseInstanceIdInternalReceiver.zzUr
at com.google.firebase.messaging.FirebaseMessagingService.zzz(Unknown Source)
at com.google.firebase.iid.zzb.onStartCommand(Unknown Source)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2805)
at android.app.ActivityThread.access$1900(ActivityThread.java:156)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1437)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
Cannot google it. Have anyone faced with it?
解决方案 Try running all services with the same version. In this case, change:
compile 'com.google.firebase:firebase-messaging:9.0.2'
to
compile 'com.google.firebase:firebase-messaging:9.2.0'
and check if the same issue happens.
这篇关于Firebase消息传递NoSuchMethodError.zzUr异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!