java–Android无法扩展Firebase Messaging Service

java–Android无法扩展Firebase Messaging Service,第1张

概述我正在尝试在我的应用程序中实现Firebase云消息传递,我已经实现了使用此服务的所有设置,但是当我尝试在我的类中扩展FirebaseMessagingService时,它给了我错误,它根本找不到它,我不能甚至可以导入com.google.firebase.messaging.FirebaseMessagingService,如图所示:我添加了所有必

我正在尝试在我的应用程序中实现Firebase云消息传递,我已经实现了使用此服务的所有设置,但是当我尝试在我的类中扩展FirebaseMessagingService时,它给了我错误,它根本找不到它,我不能甚至可以导入com.Google.firebase.messaging.FirebaseMessagingService,如图所示:

我添加了所有必需的代码:
我将此添加到app gradle

compile 'com.Google.firebase:firebase-core:9.4.0' apply plugin: 'com.Google.gms.Google-services'

这对模块gradle:

classpath 'com.Google.gms:Google-services:3.0.0'

这是清单代码:

<application    androID:allowBackup="true"    androID:icon="@mipmap/ic_launcher"    androID:label="@string/app_name"    androID:supportsRtl="true"    androID:theme="@style/Apptheme">    <activity androID:name=".MainActivity">        <intent-filter>            <action androID:name="androID.intent.action.MAIN" />            <category androID:name="androID.intent.category.LAUNCHER" />        </intent-filter>    </activity>    <service        androID:name=".MyFirebaseMessagingService">        <intent-filter>            <action androID:name="com.Google.firebase.MESSAGING_EVENT"/>        </intent-filter>    </service>    <service        androID:name=".MyFirebaseInstanceIDService">        <intent-filter>            <action androID:name="com.Google.firebase.INSTANCE_ID_EVENT"/>        </intent-filter>    </service></application>

我将谷歌Json文件添加到应用程序.
所以,如果有人能帮助我,请

解决方法:

如果要使用消息传递,则必须添加消息传递模块.现在你只添加了核心模块.

所以继续并包括

compile 'com.Google.firebase:firebase-messaging:9.4.0'

所有可用的模块都可以在https://firebase.google.com/docs/android/setup的底部找到

总结

以上是内存溢出为你收集整理的java – Android无法扩展Firebase Messaging Service全部内容,希望文章能够帮你解决java – Android无法扩展Firebase Messaging Service所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1096965.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存