在remoteMessage.getNotification()上找不到com.google.android.gms.internal.zzbgl的类文件

时间:2018-12-06 22:42:48

标签: android firebase push-notification firebase-cloud-messaging

我当前的模拟器播放服务依赖版本为12.0.1。我将所有Firebase依赖添加为12.0.1。它工作正常。但是当我调用remoteMessage.getNotification()然后抛出异常

class file for com.google.android.gms.internal.zzbgl not found at  remoteMessage.getNotification()

这是我所有的firebase依赖项

implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.firebase:firebase-database:12.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'

这是FirebaseMessaging服务类代码

public class FirebaseMessageing extends FirebaseMessagingService {
    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);

        if (remoteMessage.getNotification().getTitle().equals("New  Request")){
            showNotification(remoteMessage.getNotification().getBody());
        }

    }

}

我也将我的班级定义到清单文件中

 <service android:name=".Service.FirebaseMessageing">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>
    <service android:name=".Service.FirebaseService">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
    </service>

我该如何解决这个问题。

0 个答案:

没有答案