【问题标题】:Firebase Android - Skipping initializationFirebase Android - 跳过初始化
【发布时间】:2016-11-23 00:59:37
【问题描述】:

我目前正在实施一个使用 Firebase 云消息传递的 Android 应用。 我已经按照 Firebase 页面上的教程实现了一切。

但是,每当我尝试运行我的应用时,Firebase 初始化似乎都会失败。无论是在模拟器上还是在真实设备上,我都会收到以下调试消息:

D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
W/InstanceID/Rpc: Found 10010
D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.

它不调用InstanceIDListener。 奇怪的是,它曾经与模拟器一起工作过。

【问题讨论】:

  • 你能在这里分享你的整个 FCM 代码吗?
  • 您是否覆盖了默认清单合并处理的任何部分?此相关问题中的类似错误消息:stackoverflow.com/q/37724761/4815718.
  • 问题似乎是应用程序启动时未调用 onTokenRefresh() 方法,我认为当时 firebase 不起作用。但是,我只是在 MainActivity 中调用了“FirebaseInstanceId.getInstance().getToken()”,它就起作用了!

标签: android firebase initialization firebase-cloud-messaging


【解决方案1】:

您必须将以下内容添加到您的 android 清单中:

<service android:name=".MyFirebaseInstanceIDService">
    <intent-filter>
        <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
    </intent-filter>
</service>

【讨论】:

    【解决方案2】:

    我不确定,但我猜你错过了:

    FirebaseApp.initializeApp(getApplicationContext());
    

    https://firebase.google.com/docs/reference/android/com/google/firebase/FirebaseApp

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-27
      • 1970-01-01
      相关资源
      最近更新 更多