• <tfoot id='SCGBE'></tfoot>

      • <bdo id='SCGBE'></bdo><ul id='SCGBE'></ul>

      <small id='SCGBE'></small><noframes id='SCGBE'>

      <legend id='SCGBE'><style id='SCGBE'><dir id='SCGBE'><q id='SCGBE'></q></dir></style></legend>

    1. <i id='SCGBE'><tr id='SCGBE'><dt id='SCGBE'><q id='SCGBE'><span id='SCGBE'><b id='SCGBE'><form id='SCGBE'><ins id='SCGBE'></ins><ul id='SCGBE'></ul><sub id='SCGBE'></sub></form><legend id='SCGBE'></legend><bdo id='SCGBE'><pre id='SCGBE'><center id='SCGBE'></center></pre></bdo></b><th id='SCGBE'></th></span></q></dt></tr></i><div id='SCGBE'><tfoot id='SCGBE'></tfoot><dl id='SCGBE'><fieldset id='SCGBE'></fieldset></dl></div>
      1. 当我尝试将 Analytics 与通知一起使用时,Firebase 中没有静态方法 zzUr()

        时间:2023-07-30

        <legend id='crQT3'><style id='crQT3'><dir id='crQT3'><q id='crQT3'></q></dir></style></legend>
        <tfoot id='crQT3'></tfoot>
          • <bdo id='crQT3'></bdo><ul id='crQT3'></ul>
              <tbody id='crQT3'></tbody>
              1. <small id='crQT3'></small><noframes id='crQT3'>

                <i id='crQT3'><tr id='crQT3'><dt id='crQT3'><q id='crQT3'><span id='crQT3'><b id='crQT3'><form id='crQT3'><ins id='crQT3'></ins><ul id='crQT3'></ul><sub id='crQT3'></sub></form><legend id='crQT3'></legend><bdo id='crQT3'><pre id='crQT3'><center id='crQT3'></center></pre></bdo></b><th id='crQT3'></th></span></q></dt></tr></i><div id='crQT3'><tfoot id='crQT3'></tfoot><dl id='crQT3'><fieldset id='crQT3'></fieldset></dl></div>
                  本文介绍了当我尝试将 Analytics 与通知一起使用时,Firebase 中没有静态方法 zzUr()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我开始使用 Firebase 云消息传递.

                  I'm starting to use the Firebase Cloud Messaging.

                  我只有使用通知和分析的指南示例代码.如果我不安装 Analytics 通知工作正常,但是当我在 gradle 中添加 Analytics 时,我在尝试发送通知时收到此错误:

                  I have only the example code of the guide to use the Notifications and Analytics. If I don't install Analytics notifications works fine, but when I add in gradle the Analytics I have get this error when I try to send a notification:

                  java.lang.NoSuchMethodError: 没有静态方法 zzUr()Landroid/content/Intent;在 Lcom/google/firebase/iid/FirebaseInstanceIdInternalReceiver 类中;或其超类(com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"的声明出现在/data/app/com.myapp.newapp-2/base.apk 中)在 com.google.firebase.messaging.FirebaseMessagingService.zzz(来源不明)在 com.google.firebase.iid.zzb.onStartCommand(未知来源)在 android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3316)在 android.app.ActivityThread.access$2200(ActivityThread.java:177)在 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1547)在 android.os.Handler.dispatchMessage(Handler.java:102)在 android.os.Looper.loop(Looper.java:145)在 android.app.ActivityThread.main(ActivityThread.java:5951)在 java.lang.reflect.Method.invoke(本机方法)在 java.lang.reflect.Method.invoke(Method.java:372)在 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)在 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

                  java.lang.NoSuchMethodError: No static method zzUr()Landroid/content/Intent; in class Lcom/google/firebase/iid/FirebaseInstanceIdInternalReceiver; or its super classes (declaration of 'com.google.firebase.iid.FirebaseInstanceIdInternalReceiver' appears in /data/app/com.myapp.newapp-2/base.apk) 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:3316) at android.app.ActivityThread.access$2200(ActivityThread.java:177) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1547) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:5951) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

                  我已经毕业了:

                  compile 'com.google.firebase:firebase-messaging:9.0.2'
                  compile 'com.google.firebase:firebase-core:9.2.0'
                  

                  我的 MyFirebaseMessagingService:

                  My MyFirebaseMessagingService:

                  @Override
                  public void onMessageReceived(RemoteMessage remoteMessage) {
                      // TODO(developer): Handle FCM messages here.
                      // If the application is in the foreground handle both data and notification messages here.
                      // Also if you intend on generating your own notifications as a result of a received FCM
                      // message, here is where that should be initiated. See sendNotification method below.
                      Log.d(TAG, "From: " + remoteMessage.getFrom());
                      Log.d(TAG, "Notification Message Body: " + remoteMessage.getNotification().getBody());
                  
                      sendNotification(remoteMessage.getNotification().getBody());
                  }
                  
                  private void sendNotification(String messageBody) {
                      Intent intent = new Intent(this, MainActivity.class);
                      intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                      PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT);
                  
                      Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
                      NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
                              .setContentText(messageBody)
                              .setAutoCancel(true)
                              .setSound(defaultSoundUri)
                              .setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 })
                              .setContentIntent(pendingIntent);
                  
                      NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
                  
                      notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
                  }
                  

                  任何帮助将不胜感激!

                  推荐答案

                  试试这个:

                  添加

                  compile 'com.google.firebase:firebase-analytics:9.2.0'
                  

                  并改变这个:

                  compile 'com.google.firebase:firebase-messaging:9.0.2'
                  

                  到这个(所有版本相同)

                  to THIS (same version on all)

                  compile 'com.google.firebase:firebase-messaging:9.2.0'
                  

                  如果这不起作用,请将所有 firebase 版本设置为 9.0.2 或 9.0.0

                  if this doesn't work, put all firebase versions to 9.0.2, or 9.0.0

                  这篇关于当我尝试将 Analytics 与通知一起使用时,Firebase 中没有静态方法 zzUr()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:iOS 中的 FCM 通知在收到时不播放声音 下一篇:为每个用户创建 Firebase 主题

                  相关文章

                    <bdo id='fSeXA'></bdo><ul id='fSeXA'></ul>
                • <i id='fSeXA'><tr id='fSeXA'><dt id='fSeXA'><q id='fSeXA'><span id='fSeXA'><b id='fSeXA'><form id='fSeXA'><ins id='fSeXA'></ins><ul id='fSeXA'></ul><sub id='fSeXA'></sub></form><legend id='fSeXA'></legend><bdo id='fSeXA'><pre id='fSeXA'><center id='fSeXA'></center></pre></bdo></b><th id='fSeXA'></th></span></q></dt></tr></i><div id='fSeXA'><tfoot id='fSeXA'></tfoot><dl id='fSeXA'><fieldset id='fSeXA'></fieldset></dl></div>

                  <legend id='fSeXA'><style id='fSeXA'><dir id='fSeXA'><q id='fSeXA'></q></dir></style></legend>

                  <small id='fSeXA'></small><noframes id='fSeXA'>

                    <tfoot id='fSeXA'></tfoot>