Для FCM: при получении уведомления происходит сбой приложения и появляется ошибка java.lang.RuntimeException: невозможно создать экземпляр получателя com.google.firebase.iid.FirebaseInstanceIdReceiver: java.lang.ClassNotFoundException: не найден класс "com.google.firebase.iid.FirebaseInstanceIdReceiver "
gradle dependencies: project level
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.google.firebase:firebase-messaging:17.5.0'
gradle dependencies: app level
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
public class MyFirebaseInstanceIDService extends
FirebaseInstanceIdService {
String refreshedToken="";
@Override
public void onTokenRefresh() {
super.onTokenRefresh();
refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d("Firebase", "Refreshed token: " + refreshedToken);
}
}
public class MyFirebaseMessagingService extends FirebaseMessagingService
{
@Override
public void onNewToken(String token) {
Log.d("messaging", "Refreshed token: " + token);
// If you want to send messages to this application instance or
// manage this apps subscriptions on the server side, send the
// Instance ID token to your app server.
// sendRegistrationToServer(token);
}
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Log.d("notify message",remoteMessage.toString());
}
}