Android 无法扩展 Firebase 消息服务

2024-08-24Java开发问题
4

free vpn 本文介绍了Android 无法扩展 Firebase 消息服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧! 免费vpn下载 vpn free

问题描述

我正在尝试在我的应用程序中实现 Firebase 云消息传递,我已经实现了使用此服务的所有设置,但是当我尝试在我的类中扩展 FirebaseMessagingService 时,它给了我错误并且它可以根本找不到,连import 免费vpn下载 com.google.firebase.messaging.FirebaseMessagingService如图:

I vpn下载 am trying to 免费vpn implement Firebase Cloud Messaging in my application, I had implemented all settings to use this service, vpn free 免费vpn but when I try to extend FirebaseMessagingService in my class it gives me error and 免费vpn it can't find it at all, I can't even import com.google.firebase.messaging.FirebaseMessagingService as shown in free vpn the picture:

我已经添加了所有需要的代码:我将此添加到应用程序 vpn下载 gradle

I had added vpn下载 all the code required: I added this to app gradle

compile 'com.google.firebase:firebase-core:9.4.0' 
apply vpn free plugin: 'com.google.gms.google-services'

这个到模块 gradle:

and this to the module gradle:

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

这是清单代码:

<application
    android:allowBackup="true"
 vpn下载    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
  vpn free   android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
  vpn下载         免费vpn   <action android:name="android.intent.action.MAIN" 免费vpn />

            <category free vpn vpn free android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
   免费vpn下载  </activity>
    <service
      vpn下载   android:name=".MyFirebaseMessagingService">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT"/>
        </intent-filter>
    </service>
 免费vpn    <service
       free vpn  android:name=".MyFirebaseInstanceIDService">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
        </intent-filter>
    </service>
</application>

然后我将 google json 文件添加到应用程序中.所以如果有人可以帮助我,请

and 免费vpn下载 I added the google json file to the app. So if anybody can help me please

推荐答案

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

If you want to use messaging, you have to add the messaging module. Right now you only added the core module.

所以继续,包括

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

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

All the available 免费vpn 免费vpn下载 modules can be found at the bottom of 免费vpn下载 https://firebase.google.com/docs/android/setup

这篇关于Android 无法扩展 Firebase 消息服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

如何使用 JAVA 向 COM PORT 发送数据?
How to send data 免费vpn to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)...
2024-08-25 Java开发问题
21

如何使报表页面方向更改为“rtl"?
How to make a report page vpn下载 direction to change to vpn下载 quot;rtlquot;?(如何使报表页面方向更改为“rtl?)...
vpn下载 2024-08-25 Java开发问题
19

在 Eclipse 项目中使用西里尔文 .properties 文件
Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)...
2024-08-25 Java开发问题
18

有没有办法在 Java 中检测 RTL 语言?
Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 free vpn RTL 语言?)...
2024-08-25 Java开发问题
11

如何在 Java 中从 DB 加载资源包消息?
How 免费vpn to 免费vpn load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)...
2024-08-25 Java开发问题
13

如何更改 Java 中的默认语言环境设置以使其保持一致?
How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)...
2024-08-25 Java开发问题
13