Reputation: 341
I am developing an app in flutter I am using firebase in this app. And I am using following dependencies:
firebase_messaging: ^10.0.0
firebase_core: ^1.2.0
cloud_firestore: ^2.2.0
firebase_storage: ^8.1.0
I am initializing firebase like this:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
This whole code was working fine till today's morning but after that it is giving this error everytime:
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk...
Debug service listening on ws://127.0.0.1:53273/b_8_mVgWJY0=/ws
Syncing files to device sdk gphone x86...
I/flutter (15902): completed
E/flutter (15902): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core)
E/flutter (15902): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:7)
E/flutter (15902): <asynchronous suspension>
E/flutter (15902): #1 MethodChannel.invokeListMethod (package:flutter/src/services/platform_channel.dart:344:35)
E/flutter (15902): <asynchronous suspension>
E/flutter (15902): #2 MethodChannelFirebase._initializeCore (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:30:23)
E/flutter (15902): <asynchronous suspension>
E/flutter (15902): #3 MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:77:7)
E/flutter (15902): <asynchronous suspension>
E/flutter (15902): #4 Firebase.initializeApp (package:firebase_core/src/firebase.dart:41:31)
E/flutter (15902): <asynchronous suspension>
E/flutter (15902):
Is there anything wrong with android studio or flutter SDK itself? I have also noticed that there is one file generated that was not there earlier when the app was working fully functional the file is named "generated_plugin_registrant.dart".
Update: I removed flutter from my windows and again installed it but it didn't work as well. Now I think I should uninstall android studio completely and again install it because I don't find any error or wrong implementation in my code till now, Please tell me if there is any.
Please help me.
Thanks for your replies.
Upvotes: 3
Views: 2392
Reputation: 341
I searched a lot on the internet but the solution was very simple. It was happening because the following code was missing in my MainActivity.kt. Code:
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine); }
It was not registering the flutter plugins that's why it was giving an error it took me 2 and a half days I hope if someone else is facing this issue they can solve it earlier than me.
And thanks for all your replies.
Upvotes: 2
Reputation: 11
I had the same problem. I also tried many solution like you, but could not able to resolve it issues.
Latter, I ended up creating a new project carefully copying firebase and multiple other packages from the original project. After that I copied every single file in lib/android along with their respective configurations in build.gradle and manifests. For iOS I just copied the entire project and that worked immediately.
You also can try like my. Create a new project and copy everything from your old project to new one, one by one to see this issue resolved or not.
Upvotes: 1
Reputation: 47
Have you tried running flutter clean in the terminal?
flutter clean
and then
flutter pub get
edit:
Or,
in android/build.gradle
under dependencies
, you could use another version of gradle build tools if it helps
classpath 'com.android.tools.build:gradle:3.5.0'
Upvotes: 0
Reputation: 40
Try running
flutter clean
flutter pub get
in the terminal and see if that helps
Upvotes: 0