firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.63k stars 3.95k forks source link

[firebase_auth][iOS] MissingPluginException - Channel master, v1.12.8-pre.14 #1489

Closed syedz closed 4 years ago

syedz commented 4 years ago

Whenever I run my iPhone app I get the following error. However, the same code on Android runs just fine. It looks like iPhone doesn't want to connect to Firebase, but not completely sure. The build is just fine and it loads in the iPhone simulator, but nothing is being returned from Firestore, instead I get the following:

[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method startListeningAuthState on channel plugins.flutter.io/firebase_auth)
#0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)                      
<asynchronous suspension>                                                                                          
#1      FirebaseAuth.onAuthStateChanged.<anonymous closure> (package:firebase_auth/src/firebase_auth.dart:47:25)   
#2      _runGuarded (dart:async/stream_controller.dart:807:24)                                                     
#3      _BroadcastStreamController._subscribe (dart:async/broadcast_stream_controller.dart:215:7)                  
#4      _ControllerStream._createSubscription (dart:async/stream_controller.dart:820:19)                           
#5      _StreamImpl.listen (dart:async/stream_impl.dart:474:9)                                                     
#6      new _ForwardingStreamSubscription (dart:async/stream_pipe.dart:125:10)                                     
#7      _ForwardingStream._createSubscription (dart:async/stream_pipe.dart:93:16)                                  
#8      _ForwardingStream.listen (dart:async/stream_pipe.dart:88:12)                                               
#9      _StreamBuilderBaseState._subscribe (package:flutt<…>                                                       
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method getTemporaryDirectory on channel plugins.flutter.io/path_provider)
#0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)                      
<asynchronous suspension>                                                                                          
#1      getTemporaryDirectory (package:path_provider/path_provider.dart:35:22)                                     
#2      DefaultCacheManager.getFilePath (package:flutter_cache_manager/src/cache_manager.dart:37:27)               
#3      new BaseCacheManager (package:flutter_cache_manager/src/cache_manager.dart:60:21)                          
#4      new DefaultCacheManager._ (package:flutter_cache_manager/src/cache_manager.dart:34:29)                     
#5      new DefaultCacheManager (package:flutter_cache_manager/src/cache_manager.dart:29:23)                       
#6      _HomeState.initState (package:BazaarOh/src/screens/home.dart:29:19)                                        
#7      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4163:58)                           
#8      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4009:5)                                 
#9      E<…>                                                                                                       
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method getDatabasesPath on channel com.tekartik.sqflite)
#0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)                      
<asynchronous suspension>                                                                                          
#1      invokeMethod (package:sqflite/src/sqflite_impl.dart:20:13)                                                 
#2      SqfliteDatabaseFactoryImpl.invokeMethod (package:sqflite/src/factory_impl.dart:29:7)                       
#3      SqfliteDatabaseFactoryMixin.safeInvokeMethod.<anonymous closure> (package:sqflite/src/factory_mixin.dart:24:35)
#4      wrapDatabaseException (package:sqflite/src/exception_impl.dart:8:34)                                       
#5      SqfliteDatabaseFactoryImpl.wrapDatabaseException (package:sqflite/src/factory_impl.dart:25:7)              
#6      SqfliteDatabaseFactoryMixin.safeInvokeMethod (package:sqflite/src/factory_mixin.dart:24:7)                 
#7      SqfliteDatabaseFactoryMixin.getDatabasesPath (package:sqflite/src/factory_mixin.dart:140:17)               
#8      getDatabasesPath (package:sqflite/sqflite.dart:169:54)                                                     
#9      Ca<…>                                                                                                      
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)
#0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)                      
<asynchronous suspension>                                                                                          
#1      SharedPreferences.getInstance (package:shared_preferences/shared_preferences.dart:25:27)                   
#2      _HomeState.initialSetPageIndex (package:BazaarOh/src/screens/home.dart:38:49)                              
#3      _HomeState.initState (package:BazaarOh/src/screens/home.dart:34:5)                                         
#4      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4163:58)                           
#5      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4009:5)                                 
#6      Element.inflateWidget (package:flutter/src/widgets/framework.dart:3109:14)                                 
#7      Element.updateChild (package:flutter/src/widgets/framework.dart:2903:12)                                   
#8      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4051:16)                       
#9      Element.rebuild (package:flutt<…>                                                                          
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method Query#addSnapshotListener on channel plugins.flutter.io/cloud_firestore)
#0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)                      
<asynchronous suspension>                                                                                          
#1      Query.snapshots.<anonymous closure> (package:cloud_firestore/src/query.dart:61:37)                         
#2      _runGuarded (dart:async/stream_controller.dart:807:24)                                                     
#3      _BroadcastStreamController._subscribe (dart:async/broadcast_stream_controller.dart:215:7)                  
#4      _ControllerStream._createSubscription (dart:async/stream_controller.dart:820:19)                           
#5      _StreamImpl.listen (dart:async/stream_impl.dart:474:9)                                                     
#6      new _ForwardingStreamSubscription (dart:async/stream_pipe.dart:125:10)                                     
#7      _ForwardingStream._createSubscription (dart:async/stream_pipe.dart:93:16)                                  
#8      _ForwardingStream.listen (dart:async/stream_pipe.dart:88:12)                                               
#9      _StreamBuilderBaseState._subscribe (package:flutter/src/widgets/asy<…>                                     
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method Query#addSnapshotListener on channel plugins.flutter.io/cloud_firestore)
#0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)                      
<asynchronous suspension>                                                                                          
#1      Query.snapshots.<anonymous closure> (package:cloud_firestore/src/query.dart:61:37)                         
#2      _runGuarded (dart:async/stream_controller.dart:807:24)                                                     
#3      _BroadcastStreamController._subscribe (dart:async/broadcast_stream_controller.dart:215:7)                  
#4      _ControllerStream._createSubscription (dart:async/stream_controller.dart:820:19)                           
#5      _StreamImpl.listen (dart:async/stream_impl.dart:474:9)                                                     
#6      new _ForwardingStreamSubscription (dart:async/stream_pipe.dart:125:10)                                     
#7      _ForwardingStream._createSubscription (dart:async/stream_pipe.dart:93:16)                                  
#8      _ForwardingStream.listen (dart:async/stream_pipe.dart:88:12)                                               
#9      _StreamBuilderBaseState._subscribe (package:flutter/src/widgets/asy<…>                                     
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging                 
to ensure proper integration.                                                                                      
Syncing files to device iPhone XS...  

Here is my pubspec.yaml:

environment:
    sdk: '>=2.2.2 <3.0.0'

dependencies:
    flutter:
        sdk: flutter

    algolia: ^0.1.6+1
    cupertino_icons: ^0.1.2
    carousel_pro: ^0.0.13
    cloud_firestore: 0.12.10+2
    firebase_auth: ^0.15.0+1
    firebase_core: 0.4.2
    firebase_messaging: 5.1.6
    firebase_storage: 3.0.6
    flutter_facebook_login: 3.0.0
    flutter_image_compress: 0.6.3
    flutter_slidable: 0.5.4
    font_awesome_flutter: 8.5.0
    geoflutterfire: ^2.0.3+5
    google_maps_flutter: 0.5.21+3
    google_sign_in: ^4.0.7
    image_cropper: ^1.0.2
    image_picker: 0.6.1+4
    cached_network_image: 2.0.0-rc
    intl: ^0.15.8
    keyboard_visibility: ^0.5.6
    liquid_pull_to_refresh: ^1.1.1
    flutter_cache_manager: ^1.1.3
    location: 2.3.4
    modal_progress_hud: ^0.1.3
    package_info: 0.4.0+6
    photo_view: ^0.4.2
    provider: ^3.0.0+1
    rxdart: ^0.22.2
    shared_preferences: 0.4.3
    url_launcher: 5.0.2

dev_dependencies:
    flutter_test:
        sdk: flutter
    flutter_launcher_icons: '^0.7.0'

Here is my flutter doctor -v

[✓] Flutter (Channel master, v1.12.8-pre.14, on Mac OS X 10.14.6 18G1012, locale en-CA)
    • Flutter version 1.12.8-pre.14 at /flutter
    • Framework revision ae88f0190e (3 days ago), 2019-11-21 19:38:51 -0500
    • Engine revision 96fc607b8a
    • Dart version 2.7.0

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/zee/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.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_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.2.1, Build version 11B500
    • CocoaPods version 1.7.5

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 40.2.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.40.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.6.0

[✓] Connected device (1 available)
    • iPhone XS • F39E61CA-6A15-404C-A310-7C95B4438711 • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-1 (simulator)

• No issues found!

Any help would be really appreciated. I can provide more details if needed.

kroikie commented 4 years ago

@syedz If you could provide any of the following it would help us track down this issue:

altShiftDev commented 4 years ago

I'm getting this too with the latest update, only on iOS builds, Android is working fine. It seems to be an issue with firebase_auth as I can't get past my app's login screen but flutter does load.

My plugin versions:

  firebase_core: ^0.4.3+1
  firebase_auth: ^0.15.2
  firebase_database: ^3.1.1
  cloud_firestore: ^0.13.0+1
  firebase_messaging: ^6.0.9
mpreddie commented 4 years ago

We also have this same issue, using phone authentication. Updated to the latest version of Flutter (1.12.13+ hotfix.5), along with latest versions of firebase_core (^0.4.3+1) and firebase_auth (^0.15.2).

syedz commented 4 years ago

@kroikie All I have setup is an iOS app that won't connect to Firebase, Android will work just fine. My pubspec.yaml file is below, I've updated a few dependencies from the original post.

environment:
    sdk: '>=2.2.2 <3.0.0'

dependencies:
    flutter:
        sdk: flutter

    algolia: ^0.1.6+1
    # The following adds the Cupertino Icons font to your application.
    # Use with the CupertinoIcons class for iOS style icons.
    cupertino_icons: ^0.1.2
    carousel_pro: ^0.0.13
    cloud_firestore: ^0.12.5
    firebase_auth: ^0.15.2
    firebase_core: ^0.4.3+1
    firebase_messaging: ^6.0.9
    firebase_storage: 3.0.6
    flutter_facebook_login: 3.0.0
    flutter_image_compress: 0.6.3
    flutter_slidable: 0.5.4
    font_awesome_flutter: 8.5.0
    geoflutterfire: ^2.0.3+5
    google_maps_flutter: 0.5.21+3
    google_sign_in: ^4.0.7
    image_cropper: ^1.0.2
    image_picker: 0.6.1+4
    cached_network_image: 2.0.0-rc.1
    intl: ^0.15.8
    keyboard_visibility: ^0.5.6
    liquid_pull_to_refresh: ^1.1.1
    flutter_cache_manager: ^1.1.3
    location: 2.3.4
    modal_progress_hud: ^0.1.3
    package_info: 0.4.0+6
    photo_view: ^0.4.2
    provider: ^3.0.0+1
    rxdart: ^0.22.2
    shared_preferences: 0.4.3
    simple_moment: ^1.0.3
    url_launcher: 5.0.2

dev_dependencies:
    flutter_test:
        sdk: flutter
    flutter_launcher_icons: '^0.7.0'
syedz commented 4 years ago

Has anyone found a solution for this?

GoodLuckMySelf commented 4 years ago

Same here. Has anyone found a solution for this(2)?

bradleybeighton commented 4 years ago

I get it the other way around, it works for iOS but not Android..?

altShiftDev commented 4 years ago

@kroikie any updates here? This is a blocker for our team. We haven't been able to update our iOS app in over a month now.

kroikie commented 4 years ago

Sorry for the delay here, let me see if I can clarify some things:

@syedz you mentioned that your app is unable to connect to Firebase, are you able to use other Firebase plugins or is this an issue specific to firebase_auth plugin?

@all At what point are you seeing this MissingPluginException I would like to be able to reproduce it but I'm not seeing this when I run the example app. Eg: Is this happening when using a specific type of sign in?

@all Is this happening on a specific version of iOS?

altShiftDev commented 4 years ago

I'm using phone auth if that helps.

On Mon, Jan 13, 2020, 5:16 PM Arthur Thompson notifications@github.com wrote:

Sorry for the delay here, let me see if I can clarify some things:

@syedz https://github.com/syedz you mentioned that your app is unable to connect to Firebase, are you able to use other Firebase plugins or is this an issue specific to firebase_auth plugin?

@ALL https://github.com/ALL At what point are you seeing this MissingPluginException I would like to be able to reproduce it but I'm not seeing this when I run the example app. Eg: Is this happening when using a specific type of sign in?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/FirebaseExtended/flutterfire/issues/1489?email_source=notifications&email_token=AF6SYTDSRCKRA4IPXXATE5LQ5TR47A5CNFSM4JQ7RIJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEI2QBGI#issuecomment-573898905, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF6SYTE23WRQN5ZVLPYJOJTQ5TR47ANCNFSM4JQ7RIJA .

kroikie commented 4 years ago

@altShiftDev would you mind sharing your error? The one seen in the original post Unhandled Exception: MissingPluginException(No implementation found for method startListeningAuthState on channel plugins.flutter.io/firebase_auth) should no longer happen.

altShiftDev commented 4 years ago

@kroikie I get this after waiting 5min+ for it to build in debug mode:

Exception has occurred.
MissingPluginException (MissingPluginException(No implementation found for method startListeningAuthState on channel plugins.flutter.io/firebase_auth))

Which breaks on line 26 of firebase_user_repository.dart. Then in the debug console I see the following after stepping through the initial crash:

[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method startListeningAuthState on channel plugins.flutter.io/firebase_auth)
#0      MethodChannel.invokeMethod
<asynchronous suspension>
#1      MethodChannelFirebaseAuth.onAuthStateChanged.<anonymous closure>
#2      _runGuarded  (dart:async/stream_controller.dart:807:24)
#3      _BroadcastStreamController._subscribe  (dart:async/broadcast_stream_controller.dart:215:7)
#4      _ControllerStream._createSubscription  (dart:async/stream_controller.dart:820:19)
#5      _StreamImpl.listen  (dart:async/stream_impl.dart:474:9)
#6      new _ForwardingStreamSubscription  (dart:async/stream_pipe.dart:125:10)
#7      _ForwardingStream._createSubscription  (dart:async/stream_pipe.dart:93:16)
#8      _ForwardingStream.listen  (dart:async/stream_pipe.dart:88:12)
#9      n<…>
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method startListeningAuthState on channel plugins.flutter.io/firebase_auth)
#0      MethodChannel.invokeMethod
<asynchronous suspension>
#1      MethodChannelFirebaseAuth.onAuthStateChanged.<anonymous closure>
#2      _runGuarded  (dart:async/stream_controller.dart:807:24)
#3      _BroadcastStreamController._subscribe  (dart:async/broadcast_stream_controller.dart:215:7)
#4      _ControllerStream._createSubscription  (dart:async/stream_controller.dart:820:19)
#5      _StreamImpl.listen  (dart:async/stream_impl.dart:474:9)
#6      new _ForwardingStreamSubscription  (dart:async/stream_pipe.dart:125:10)
#7      _ForwardingStream._createSubscription  (dart:async/stream_pipe.dart:93:16)
#8      _ForwardingStream.listen  (dart:async/stream_pipe.dart:88:12)
#9      n<…>
kroikie commented 4 years ago

@altShiftDev firebase_user_repository.dart is not a file in the firebase_auth plugin. I'm looking for the firebase_auth call that is resulting in this exception.

altShiftDev commented 4 years ago

@kroikie well, that's where it breaks...

FirebaseUserRepository({FirebaseAuth firebaseAuth})
      : _firebaseAuth = firebaseAuth ?? FirebaseAuth.instance,
        _fcm = FirebaseMessaging() {
      _firebaseAuth.onAuthStateChanged.listen(_onAuthStateChanged); // this is where the exception is thrown.
  }
kroikie commented 4 years ago

That helps, I will take a look. Thanks.

syedz commented 4 years ago

@kroikie This issue seems to be specific to the firebase_auth plugin.

So I got this working. I don't know if this is going to work for others, but here's what I did.

I'm actually surprised that this resolved my problem, and a bit concerned that this might resurface again. But maybe this will work for someone else so I figured I'd post it.

kroikie commented 4 years ago

@syedz Thanks for posting that. The error itself is strange to me since MissingPluginException(No implementation found for method... errors indicate there is some method on the Dart side of the channel that is not implemented on the native side. This is not the case for startListeningAuthState as it is implemented on iOS.

I'll leave this open for anyone else that can provide repro steps but I will remove the regression label.

rohandalvi commented 4 years ago

Any update on this issue? I don't think this problem is hard to reproduce..

rohandalvi commented 4 years ago

@Ehesp @kroikie

If you need my system flutter doctor/run logs, you can find them in the above issue that @helenaford closed and consolidated in favor of this issue.

I see a blocked: customer response label on this set in December. To reproduce the issue In my case, it is as simple as just calling the verifyPhoneNumber method during the sign in process.

This issue is blocking my app from releasing on iOS. I would be more than happy to answer any follow up questions. Thanks!

purvajg commented 4 years ago

Any update here?? We have been waiting for over a month for the release. Not able to test it on iphone !

preetshah21699 commented 4 years ago

I'm facing the same issue on Android Platform. I'm trying Phone Number Authentication. However, it shows the same thing. Is it possible that we didn't put something in the gradle.build files that is causing this issue?

preetshah21699 commented 4 years ago

I solved the issue by adding the following dependencies to my app level "build.gradle" file, I also changed the gradle version and changed it to 6.4. Also, adding crashlytics dependency to this file may cause issues if you haven't followed the proper process for using crashlytics on your Flutter app.

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation "com.google.firebase:firebase-analytics:17.4.1"
    implementation "com.google.firebase:firebase-database:19.3.0"
    implementation "com.google.firebase:firebase-storage:19.1.1"
}

However, it is to be noted that Flutter should have something to display the crashes caused by crashlytics or due to incomplete dependencies.

palkerecsenyi commented 4 years ago

I'm facing this issue on firebase_auth: ^0.16.0 too

rohandalvi commented 4 years ago

To everyone still affected by this issue, this is what finally worked for me -

You need to register the plugin with the AppDelegate using

GeneratedPluginRegistrant.register(with: self)

If you are using the AppDelegate.swift file as instructed during firebase setup, you need to replace it with -

import UIKit
import Firebase
import Flutter

@UIApplicationMain
class AppDelegate: FlutterAppDelegate {
    override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil
    ) -> Bool {
        FirebaseApp.configure()
        GeneratedPluginRegistrant.register(with: self)
        return super.application(application, didFinishLaunchingWithOptions: launchOptions) // YES;
    }
}

For Objective-C users, the AppDelegate.m should look like this ( thanks to https://github.com/flutter/flutter/issues/28874#issuecomment-486359780 ) -

#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"

@import UIKit;
@import Firebase;

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [FIRApp configure];
  [GeneratedPluginRegistrant registerWithRegistry:self];
  return [super application:application didFinishLaunchingWithOptions:launchOptions]; // YES;
}
@end
TreeStrepek commented 4 years ago

Thanks @rohandalvi . Your solution worked for me!

To be clear. I updated my AppDelegate.swift with the following body & my IOS build succeeds per usual. .................................................................................................................... @UIApplicationMain class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil ) -> Bool { FirebaseApp.configure() GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) // YES; }

frec0717 commented 4 years ago

delete .flutter-plugins and .flutter-plugins-dependencies and finally pub get

google-oss-bot commented 4 years ago

Hey @syedz. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 4 years ago

Since there haven't been any recent updates here, I am going to close this issue.

@syedz if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.