Somewhere between firebase_messaging 6.0.1 and the lastest 6.0.9 the plugin broke for me.
I followed the instructions and created an Application.java file (I changed the package):
package io.flutter.plugins.firebasemessagingexample;
import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
import io.flutter.plugins.GeneratedPluginRegistrant;
import io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService;
public class Application extends FlutterApplication implements PluginRegistrantCallback {
@Override
public void onCreate() {
super.onCreate();
FlutterFirebaseMessagingService.setPluginRegistrant(this);
}
@Override
public void registerWith(PluginRegistry registry) {
GeneratedPluginRegistrant.registerWith(registry);
}
}
After upgrading to 6.0.9, I receive the following compile-time error:
Application.java:13: error: cannot access FirebaseMessagingService
FlutterFirebaseMessagingService.setPluginRegistrant(this);
^
class file for com.google.firebase.messaging.FirebaseMessagingService not found
1 error
0.6.4Through testing every version, I found out that the upgrade to 0.6.4 is faulty. There are only versions 0.6.3 and 0.6.7 on Pub, but the versions in between did not touch Android at all, so it has to be 0.6.4.
Step 5 in the Android integration instructions for handling background messages states the following:
Note:
configureshould be called early in the lifecycle of your application so that it can be ready to receive messages as early as possible. See the example app for a demonstration.
This is somewhat false because background messages are not configured at all in the example project. Adding it to the example project would also allow testing it.
Facing exactly same issue. Any solution for it?
@zeromaro Yes! Check #1664. Read the first step of the updated instructions. It should be pushed to Pub soon :)
I have same problem, I seen updated instructions and add firebase_messaging library to app build.gradle dependencies section:
dependencies {
// ...
implementation 'com.google.firebase:firebase-messaging:20.1.0'
}
After that this issue solved for me:
Application.java:13: error: cannot access FirebaseMessagingService
FlutterFirebaseMessagingService.setPluginRegistrant(this);
^
class file for com.google.firebase.messaging.FirebaseMessagingService not found
1 error
thanks its work for me
thanks! my project is alive again!
project > build.gradle
ext.kotlin_version = '1.3.50'
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
app > build.gradle
implementation "com.google.firebase:firebase-messaging:20.1.0"
pubsec.yaml
firebase_messaging: ^6.0.9
Most helpful comment
I have same problem, I seen updated instructions and add firebase_messaging library to app build.gradle dependencies section:
After that this issue solved for me: