Flutter FirebaseCloudMessagingPluginRegistrant is not found?

Viewed 456

I added firebase push notification things to my flutter project. Then I could not start my project because it does not find the FirebaseCloudMessagingPluginRegistrant.

When yesterday I added these to my project, everything worked fine. Today I needed to change some stuff in Android part but all of the files were full of red lines what got fixed by deleting the .idea folder. But now if I try to start the project:

D:\...\android\app\src\main\java\com\Application.java:17: error: cannot find symbol
    FirebaseCloudMessagingPluginRegistrant.registerWith(registry);
    ^
  symbol:   variable FirebaseCloudMessagingPluginRegistrant
  location: class Application

It happens in this class:

import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
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) {
    FirebaseCloudMessagingPluginRegistrant.registerWith(registry); // This line
  }
}

I don't find a way how to fix this...

I added these to the build.gradle files:

apply plugin: 'com.google.gms.google-services'

implementation platform('com.google.firebase:firebase-bom:27.1.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-messaging'

and

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

Not sure if you need more info to be able to help me?

0 Answers
Related