Skip to content
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 #3

Closed
micajuine-ho opened this issue Jan 13, 2019 · 12 comments
Closed

MissingPluginException #3

micajuine-ho opened this issue Jan 13, 2019 · 12 comments
Assignees

Comments

@micajuine-ho
Copy link

Hey man,

Thank you for making this package, I am really excited to use it.
Unfortunately, the package throws a MissingPluginException:

`The following MissingPluginException was thrown while activating platform stream on channel github.com/adee42/flutter_keyboard_visibility:

MissingPluginException(No implementation found for method listen on channel github.com/adee42/flutter_keyboard_visibility)`

I cloned your repo, added it to my project and updated my dependencies. Any idea on why this is happening?

@adee42
Copy link
Owner

adee42 commented Jan 13, 2019

Hi man,

you are welcome. I'll take a guess here and say that you copied the files into your project directly without using the pubspec.yaml file. If you want to integrate this directly, you also have to add a few lines to the native code to register the plugin (this is something that Flutter does automatically when you include it in the pubspecs).

For Android you have to add the following line in the MainActivity.java file (I usually do it above the GeneratedPluginRegistrant.registerWith(this); - line):
KeyboardVisibilityPlugin.registerWith(this.registrarFor("com.github.adee42.keyboardvisibility"));

For iOS you have to add the following line in the AppDelegate.m file:
[KeyboardVisibilityHandler registerWithRegistrar:[self registrarForPlugin:@"com.github.adee42.keyboardvisibility"]];

If you didn't copy the files directly, please let me know how you included this plugin into your pubspec.yaml file.

@adee42 adee42 self-assigned this Jan 13, 2019
@micajuine-ho
Copy link
Author

Ahh thank you, I got it working!

I was wondering if there was a better way to use this package, other than cloning it and having the code directly in my project.

Thanks again.

@diego-lipinski-de-castro

I installed this plugin via the yaml file and got the same error

@diego-lipinski-de-castro
Copy link

diego-lipinski-de-castro commented Jan 17, 2019

It seems that fully stopping the application and re-running it solves the problem, this is an important note, should be on the readme I think, it wont work if you only refresh the app after getting the package, you need to fully restart your app

Edit: this is not a this plugin problem, while using android studio, i needed to do a fully restart to every new package I installed

@adee42
Copy link
Owner

adee42 commented Jan 17, 2019

Yes, this is true. If you add plugins in Flutter you need to restart the whole application. Only then will the native code be executed

Edit: this only applies if the Flutter plugin includes some native code, otherwise you don't need to restart

@adee42 adee42 closed this as completed Jan 19, 2019
@Leeeeerich
Copy link

Leeeeerich commented Nov 15, 2019

Hi! I have same problem, but i use pubspec.yaml and it not work(((

Then i added:

KeyboardVisibilityPlugin.registerWith(this.registrarFor("com.github.adee42.keyboardvisibility"));

For iOS you have to add the following line in the AppDelegate.m file:
[KeyboardVisibilityHandler registerWithRegistrar:[self registrarForPlugin:@"com.github.adee42.keyboardvisibility"]]; ```

And not worked it!

@remoteportal
Copy link

remoteportal commented Feb 22, 2020

Completely re-starting app did not help:

════════ Exception caught by services library ══════════════════════════════════════════════════════
The following MissingPluginException was thrown while activating platform stream on channel flutter_keyboard_visibility:
MissingPluginException(No implementation found for method listen on channel flutter_keyboard_visibility)

When the exception was thrown, this was the stack:
#0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)

#1 EventChannel.receiveBroadcastStream. (package:flutter/src/services/platform_channel.dart:517:29)
#3 EventChannel.receiveBroadcastStream. (package:flutter/src/services/platform_channel.dart:503:64)
#8 new KeyboardVisibilityNotification (package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart:37:10)
...

@lewisMachilika
Copy link

For me stopping and starting the app worked

@Nike682631
Copy link

MissingPluginException (MissingPluginException(No implementation found for method listen on channel flutter_keyboard_visibility))
I'm facing the above issue when writing integration test for my app.

@bradfrizzell
Copy link

I am also facing the same issue in my integration test

@davestimpert
Copy link

davestimpert commented May 20, 2024

I am also facing the same issue in my integration test

@bradfrizzell Did you find a solution?

@davestimpert
Copy link

@bradfrizzell this got me around the issue:

class _KeyboardVisibilityBuilder extends StatelessWidget {
  final Widget Function(BuildContext, bool) builder;

  const _KeyboardVisibilityBuilder({required this.builder});

  @override
  Widget build(BuildContext context) {
    if (Platform.environment.containsKey('FLUTTER_TEST')) {
      return builder(context, false);
    }
    return KeyboardVisibilityBuilder(builder: builder);
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants