Unhandled Exception: MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core) in "IOS" only #6262
Unanswered
SyedMuhammadMuhid
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am unable to resolve this error that I get while I run my flutter app on ios Simulator (IPhone 12 pro max). This application is running normally on android emulators and devices.
The message that I get in Run:
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running Xcode build...
Xcode build done. 643.6s
Debug service listening on ws://127.0.0.1:59848/2DbBjErz6yw=/ws
Syncing files to device iPhone 12 Pro Max...
[VERBOSE-2:ui_dart_state.cc(199)] Unhandled Exception: MissingPluginException(No implementation found for method Firebase#initializeCore on channel plugins.flutter.io/firebase_core)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:7)
#1 MethodChannel.invokeListMethod (package:flutter/src/services/platform_channel.dart:344:35)
#2 MethodChannelFirebase._initializeCore (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:30:23)
#3 MethodChannelFirebase.initializeApp (package:firebase_core_platform_interface/src/method_channel/method_channel_firebase.dart:77:7)
#4 Firebase.initializeApp (package:firebase_core/src/firebase.dart:41:31)
#5 main (package:farmex/main.dart:19:3)
This is my main.dart
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'Screens/select_language.dart';
import 'Services/phone_stream_service.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'constants/language/language_preferences.dart';
import 'constants/constants_global.dart';
import 'package:localstorage/localstorage.dart';
import 'package:farmex/Services/api_services.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:shared_preferences/shared_preferences.dart';
void main()async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
await getLanguage();
}
class MyApp extends StatefulWidget {
@OverRide
_MyAppState createState() => _MyAppState();
static _MyAppState of(BuildContext context) => context.findAncestorStateOfType<_MyAppState>();
}
class _MyAppState extends State with WidgetsBindingObserver{
Locale _locale;
bool wait = true;
User firebaseuser;
void setLocale(Locale value) {
if (mounted) {
setState(() {
_locale = value;
});
}
}
@OverRide
void initState() {
}
@OverRide
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
@OverRide
Widget build(BuildContext context) {
}
void getBioData()async {
langChanger=false;
firebaseuser = await FirebaseAuth.instance.currentUser;
if(firebaseuser!=null) {
Global_access_token = await LoginServices(
firebaseId: firebaseuser.uid.toString(), appId: Global_appId)
.getAccessToken();
print(Global_access_token);
await GetUserBioData(accessToken: Global_access_token)
.GetUserBioDataDetails()
.then((value) {
if (mounted) {
setState(() {
BioData = value[0];
wait = false;
});
}
print(
"I am the BioData var, i contain language data. Language is: ${BioData
.userProfileLanguage}");
});
}
else{
if (mounted) {
setState(() {
wait = false;
});
}
}
}
}
void getLanguage()async{
SharedPreferences.setMockInitialValues({});
SharedPreferences Lang = await SharedPreferences.getInstance();
userLanguage = Lang.getString('userLanguage');
print('getLanguage() called, userlanguage : ${userLanguage}');
}
This is my project's pubspec.yaml
name: farmex
description: A new Flutter application.
version: 1.0.1+8
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
cupertino_icons: ^1.0.3
google_fonts: ^2.1.0
pin_entry_text_field: ^0.1.4
font_awesome_flutter: ^9.0.0
flutter_svg: ^0.22.0
table_calendar: ^3.0.0
roundcheckbox: ^2.0.1
http: ^0.13.3
flutter_spinkit: ^5.0.0
toast: ^0.1.5
modal_progress_hud: ^0.1.3
intl: ^0.17.0
im_stepper: ^0.1.3
google_maps_flutter: ^2.0.5
flutter_datetime_picker: ^1.5.1
geolocator: ^7.0.3
location: ^4.1.1
geocoding: ^2.0.0
geocoder: ^0.2.1
image_picker: ^0.7.5+3
firebase_storage: ^8.1.0
flutter_tts: ^3.1.0
charts_flutter: ^0.10.0
photo_view: ^0.11.1
showcaseview: ^1.0.0
holding_gesture: ^1.1.0
flutter_plugin_record: ^1.0.1
audioplayers: ^0.19.0
permission_handler: ^8.0.0+2
shared_preferences: ^2.0.6
dots_indicator: ^2.0.0
localstorage: ^4.0.0+1
qr_code_scanner: ^0.4.0
android_intent: ^2.0.1
firebase_auth: ^1.2.0
firebase_core: "^1.2.0"
dependency_overrides:
uses-material-design: true
assets:
- assets/images/
- assets/icons/
- assets/weather/
- assets/more/
- assets/news/
fonts:
- family: geomanist
fonts:
- asset: fonts/geomanist-regular-webfont.ttf
This is the project's AppDelegate.swift
import UIKit
import Firebase
import Flutter
import GoogleMaps
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil
) -> Bool {
FirebaseApp.configure()
GMSServices.provideAPIKey("AIzaSyBvwaQSH5IxqTPWIHA2LctbqdrP8MRyK_w")
return super.application(application, didFinishLaunchingWithOptions: launchOptions) // YES;
}
}
This is the project's AppDelegate.m
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import "GoogleMaps/GoogleMaps.h"
@import UIKit;
@import Firebase;
@implementation AppDelegate
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GMSServices provideAPIKey:@"AIzaSyBvwaQSH5IxqTPWIHA2LctbqdrP8MRyK_w"];
[FIRApp configure];
[GeneratedPluginRegistrant registerWithRegistry:self];
return [super application:application didFinishLaunchingWithOptions:launchOptions]; // YES;
}
@EnD
This is the Podfile
platform :ios, '10.2'
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), FILE)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
pod 'Firebase/Core'
use_frameworks! #add here
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(FILE))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.2'
end
end
flutter doctor -v
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.0, on macOS 11.3 20E232 darwin-x64, locale en-AE)
• Flutter version 2.2.0 at /Users/xyphertechnologies/developer/flutter
• Framework revision b22742018b (13 days ago), 2021-05-14 19:12:57 -0700
• Engine revision a9d88a4d18
• Dart version 2.13.0
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/xyphertechnologies/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5, Build version 12E262
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] Connected device (2 available)
• iPhone 12 Pro Max (mobile) • C0615887-44CC-4010-8DF8-7F77ED55F4D4 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
Androis studio ios file structure:
xcode Runner.xcworkspace file structure:
I hope you can help me find a solution to this issue, I am stuck on this for days now, thanks.
Beta Was this translation helpful? Give feedback.
All reactions