1
votes

On my release version of my flutter android app I am getting this error.

I have tried:

Updating the SHA-1 Key from Google Play Console in Firebase Updating google-services.json Rebuilding and rolling out.

I still get this error. I have INTERNET_PERMISSIONS enabled and cleartext=true as well.

App works fine in iOS and android debug mode as well.

2021-02-15 00:47:37.450 2888-2932/? E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method configure on channel plugins.flutter.io/firebase_messaging) #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:157) 2021-02-15 00:47:37.450 2888-2932/? E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method getToken on channel plugins.flutter.io/firebase_messaging) #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:157) #1 FirebaseMessaging.getToken (package:firebase_messaging/firebase_messaging.dart:146)

2

2 Answers

2
votes

Please make sure you have implemented following steps:

1: Add dep in pubspecs.yaml

firebase_core: ^0.5.3
firebase_messaging: ^7.0.3

2: Add dependency & service in the app build.gradle file.

dependencies {

 implementation platform('com.google.firebase:firebase-bom:26.5.0')
 
 implementation 'com.google.firebase:firebase-messaging'
 
}

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

3: proper google-service.json under app directory only

4: Initialization in main.dart

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runApp(MyApp());
}

5: Add this code in your main class or 1st executing class

final FirebaseMessaging firebaseMessaging = FirebaseMessaging();
  
firebaseMessaging.getToken().then((token){
  print("token $token");
}); 
0
votes

Add this dependency in the app build.gradle file.

implementation 'com.google.firebase:firebase-messaging:21.0.1'