New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MissingPluginException: No implementation found for method #10912

Closed
bramvbilsen opened this Issue Jun 22, 2017 · 11 comments

Comments

Projects
None yet
8 participants
@bramvbilsen
Copy link

bramvbilsen commented Jun 22, 2017

I'm trying to get the documents directory but keep getting the following error:
MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider)
I added the package in my pubspec file and ran the get command without any error.
This is the code I used (It's from the flutter.io website):

Future<File> _getLocalFile() async { 
      // get the path to the document directory. 
      String dir = (await getApplicationDocumentsDirectory()).path; 
      return new File('$dir/gamerel_data.json'); 
}

I'm using plugin version: 0.2.1+1

@eseidelGoogle

This comment has been minimized.

Copy link
Contributor

eseidelGoogle commented Jun 22, 2017

@mravn-google would know.

@mravn-google

This comment has been minimized.

Copy link
Contributor

mravn-google commented Jun 22, 2017

@bramvbilsen Thanks for reporting. The plugin apparently hasn't been registered on the platform side. A few questions:

  1. Does it fail on iOS, Android, or both?
  2. Have you executed flutter run targeting that platform since you changed the pubspec file? This is needed to have Flutter inject plugin dependencies into the platform-specific parts of your app. Please note that hot restart/hot reload is not enough to trigger the injection.
  3. Does the GeneratedPluginRegistrant file that flutter run should have generated in your project contain a line registering the path provider plugin?
  4. Does your AppDelegate.m (iOS) or MainActivity.java (Android) contain a call to GeneratedPluginRegistrant asking it to register itself? Those calls should be made from the app launch method (application:didFinishLaunchingWithOptions: on iOS, onCreate on Android) as exemplified here.
@bramvbilsen

This comment has been minimized.

Copy link

bramvbilsen commented Jun 23, 2017

@mravn-google Yeah, turned out I had to quit the flutter run process and start it up again. Just a full restart within flutter run didn't work.

@mravn-google mravn-google changed the title Path Provider: Missing Plugin Implementation MissingPluginException: No implementation found for method Jun 23, 2017

@mravn-google

This comment has been minimized.

Copy link
Contributor

mravn-google commented Jun 23, 2017

Updated issue to serve as FAQ for other people getting the same exception.

@arranf

This comment has been minimized.

Copy link

arranf commented Jan 16, 2018

I've ran into this twice this week on separate projects. flutter clean fixed it.

@toregua

This comment has been minimized.

Copy link

toregua commented Feb 9, 2018

Hi all, i have exactly the same problem :

 E/flutter ( 8944): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter ( 8944): MissingPluginException(No implementation found for method configure on channel firebase_messaging)
E/flutter ( 8944): #0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:153:7)
E/flutter ( 8944): <asynchronous suspension>
E/flutter ( 8944): #1      FirebaseMessaging.configure (package:firebase_messaging/firebase_messaging.dart:69:14)
E/flutter ( 8944): #2      SortieSportAppState._initFirebaseMessaging (/data/user/0/com.yourcompany.sortiesportmobile/cache/sortiesport_mobileVTOQQT/sortiesport_mobile/lib/sortiesport/app.dart:49:24)
E/flutter ( 8944): #3      SortieSportAppState.initState (/data/user/0/com.yourcompany.sortiesportmobile/cache/sortiesport_mobileVTOQQT/sortiesport_mobile/lib/sortiesport/app.dart:44:5)
E/flutter ( 8944): #4      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3711:14)
E/flutter ( 8944): #5      ComponentElement.mount (package:flutter/src/widgets/framework.dart:3577:5)
E/flutter ( 8944): #6      Element.inflateWidget (package:flutter/src/widgets/framework.dart:2875:14)
E/flutter ( 8944): #7      Element.updateChild (package:flutter/src/widgets/framework.dart:2678:12)
E/flutter ( 8944): #8      RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:852:16)
E/flutter ( 8944): #9      RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:823:5)
E/flutter ( 8944): #10     RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> (package:flutter/src/widgets/binding.dart:769:17)
E/flutter ( 8944): #11     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2190:19)
E/flutter ( 8944): #12     RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:768:13)
E/flutter ( 8944): #13     BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding&WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:657:7)
E/flutter ( 8944): #14     runApp (package:flutter/src/widgets/binding.dart:699:7)
E/flutter ( 8944): #15     main (/data/user/0/com.yourcompany.sortiesportmobile/cache/sortiesport_mobileVTOQQT/sortiesport_mobile/lib/main.dart:21:3)
E/flutter ( 8944): #16     _startIsolate.<anonymous closure> (dart:isolate-patch/dart:isolate/isolate_patch.dart:278)
E/flutter ( 8944): #17     _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:164)
Restarted app in 5 909ms.

This error appear when i use :

    _firebaseMessaging.configure(
      onMessage: (Map<String, dynamic> message) {
        print("onMessage: $message");
        // _showItemDialog(message);
      },
      onLaunch: (Map<String, dynamic> message) {
        print("onLaunch: $message");
        // _navigateToItemDetail(message);
      },
      onResume: (Map<String, dynamic> message) {
        print("onResume: $message");
        // _navigateToItemDetail(message);
      },
    );

Thanks in advance

@mravn-google

This comment has been minimized.

Copy link
Contributor

mravn-google commented Feb 9, 2018

@toregua

This comment has been minimized.

Copy link

toregua commented Feb 9, 2018

@mravn-google thank you for your answer. Finaly i have found the generated file.
I have also found why i have the MissingPluginException. In my MainActivity.java i use code in order to deal with deep link and one line of my code was causing this error.

These lines was :

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GeneratedPluginRegistrant.registerWith(this);
    final FlutterView view = new FlutterView(this);
    deepLinkChannel = new MethodChannel(view, "DEEPLINK");
  }

And if i replace final FlutterView view = new FlutterView(this); with FlutterView view = getFlutterView(); like this :

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GeneratedPluginRegistrant.registerWith(this);
    FlutterView view = getFlutterView();
    deepLinkChannel = new MethodChannel(view, "DEEPLINK");
  }

the missing exception disappears. Hope it will help other people

@amirfeqhi

This comment has been minimized.

Copy link

amirfeqhi commented Dec 15, 2018

@bramvbilsen Thanks for reporting. The plugin apparently hasn't been registered on the platform side. A few questions:

1. Does it fail on iOS, Android, or both?

2. Have you executed `flutter run` targeting that platform since you changed the pubspec file? This is needed to have Flutter inject plugin dependencies into the platform-specific parts of your app. _Please note that hot restart/hot reload is not enough to trigger the injection_.

3. Does the `GeneratedPluginRegistrant` file that `flutter run` should have generated in your project contain a line registering the path provider plugin?

4. Does your `AppDelegate.m` (iOS) or `MainActivity.java` (Android) contain a call to `GeneratedPluginRegistrant` asking it to register itself? Those calls should be made from the app launch method (`application:didFinishLaunchingWithOptions:` on iOS, `onCreate` on Android) as exemplified [here](https://github.com/flutter/plugins/blob/master/packages/path_provider/example).

Thank you, It turns out, the AppDelegate.m file should contain, [GeneratedPluginRegistrant registerWithRegistry:self];. It will fix the problem.

@keviepanas

This comment has been minimized.

Copy link

keviepanas commented Dec 27, 2018

Hello sorry to bring this back but i have slightly a different but related problem in using the path_provider package:

E/flutter (27277): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter (27277): Reading static variable '_instance@20369938' during its initialization
E/flutter (27277): #0      DatabaseHelper._instance (package:databases_crud/utils/database_helper.dart:8:31)
E/flutter (27277): #1      new DatabaseHelper (package:databases_crud/utils/database_helper.dart:9:29)
E/flutter (27277): #2      DatabaseHelper._instance (package:databases_crud/utils/database_helper.dart:8:47)
E/flutter (27277): #3      DatabaseHelper._instance (package:databases_crud/utils/database_helper.dart:8:31)
E/flutter (27277): #4      new DatabaseHelper (package:databases_crud/utils/database_helper.dart:9:29)
E/flutter (27277): #5      main (package:databases_crud/main.dart:8:16)
E/flutter (27277): <asynchronous suspension>
E/flutter (27277): #6      _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:289:19)
E/flutter (27277): #7      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
Syncing files to device SM G930F...                              2,8s

🔥  To hot reload changes while running, press "r". To hot restart (and rebuild state), press "R".
An Observatory debugger and profiler on SM G930F is available at: http://127.0.0.1:65147/
For a more detailed help message, press "h". To detach, press "d"; to quit, press "q".

Initializing hot reload... Error -32601 received from application: Method not found
Error -32601 received from application: Method not found
@zoechi

This comment has been minimized.

Copy link
Contributor

zoechi commented Dec 27, 2018

@keviepanas sounds more like an issue with database_crud than with path_provider

Please consider asking support questions in one of the other channels listed at http://flutter.io/support .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment