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: No implementation found for method loadUrl #209

Closed
jfeliubadalo opened this issue Dec 3, 2019 · 13 comments
Closed

Comments

@jfeliubadalo
Copy link

When i call this method, throw this exception:
imagen

[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method loadUrl on channel com.pichillilorenzo/flutter_inappwebview_0)
#0 MethodChannel.invokeMethod
package:flutter/…/services/platform_channel.dart:314

#1 InAppWebViewController.loadUrl
package:flutter_inappbrowser/src/in_app_webview.dart:907

#2 _WebState._reloadPage

@pichillilorenzo
Copy link
Owner

This is very strange. Try to clean the project! Can you share the code, please?

@ositano
Copy link

ositano commented Dec 5, 2019

I am also getting this error while trying to run controller.evaluateJavascript(source: "alert('HI');");

[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method evaluateJavascript on channel com.pichillilorenzo/flutter_inappwebview_0)
#0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:314:7)

#1 InAppWebViewController.evaluateJavascript (package:flutter_inappwebview/src/in_app_webview.dart:1296:31)

#2 TabShopState.build.. (package:dimchy/views/tab_shop.dart:632:38)
#3 InAppWebViewController.handleMethod (package:flutter_inappwebview/src/in_app_webview.dart:488:19)

#4 MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:397:55)

#5 MethodChannel.setMethodCallHandler. (package:flutter/src/services/platform_channel.dart:365:54)
#6 _DefaultBinaryMessenger.handlePlatformMessage (package:flutter/src/<…>

@ositano
Copy link

ositano commented Dec 5, 2019

After flutter clean, the app crashes upon executing controller.evaluateJavascript(source: "alert('HI');");

@pichillilorenzo
Copy link
Owner

@ositano @jfeliubadalo check out this: flutter/flutter#10912
As reported from there:

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.

The GeneratedPluginRegistrant files are generated by Flutter build/run tooling. So if you execute flutter build apk or flutter run, it should work. We are working on improving the user experience here, cf. flutter/flutter#14560.

Take a look at my example:

They both contain GeneratedPluginRegistrant.

@konstantin-mohin
Copy link

konstantin-mohin commented Jan 24, 2020

I had the same problem,
to fix it you need to remove an app from your device then run flutter run
(before that I also used flutter clean not sure if it is necessary)

@ruan65
Copy link

ruan65 commented Feb 11, 2020

@konstantin-mohin Спасибо Костя!
This is strange enough, but it helps

@hisaichi5518
Copy link

I use flutter_inappwebview 2.1.0+1.

The same error occurred when performing a Hot restart with an iOS app. It didn't happen with Android apps. After an error, rebuilding worked as expected.

flutter: MissingPluginException(No implementation found for method canGoBack on channel com.pichillilorenzo/flutter_inappwebview_0)
flutter: 
#0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:319:7)
<asynchronous suspension>
#1      InAppWebViewController.canGoBack (package:flutter_inappwebview/src/in_app_webview.dart:1217:27)
#2      _NavigationControlsState.initState.<anonymous closure> (package:stailer/components/navigation_controls.dart:31:43)
<asynchronous suspension>
#3      _rootRunUnary (dart:async/zone.dart:1134:38)
#4      _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#5      _CustomZone.runUnaryGuarded (dart:async/zone.dart:933:7)
#6      _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:970:26)
#7      _rootRunUnary (dart:async/zone.dart:1138:13)
#8      _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#9      _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:954:26)
#10     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:384:19)
#11     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5)
#12     _<…>

I commented out IAWController?.channel?.setMethodCallHandler(nil) in removeFromSuperview method of InAppWebView.swift and found that it works as expected.
https://github.com/pichillilorenzo/flutter_inappwebview/blob/v2.1.0%2B1/ios/Classes/InAppWebView.swift#L2198

However, it seems that there is no IAWController?.channel?.setMethodCallHandler(nil) in the master branch. So, I changed pubspec.yaml as follows.

  flutter_inappwebview:
    git:
      url: [email protected]:pichillilorenzo/flutter_inappwebview.git
      ref: '9c7ac0d'

@msarkrish
Copy link

msarkrish commented Mar 2, 2020

@ositano @jfeliubadalo check out this: flutter/flutter#10912
As reported from there:

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.

The GeneratedPluginRegistrant files are generated by Flutter build/run tooling. So if you execute flutter build apk or flutter run, it should work. We are working on improving the user experience here, cf. flutter/flutter#14560.

Take a look at my example:

* `MainActivity.java` (Android): https://github.com/pichillilorenzo/flutter_inappwebview/blob/master/example/android/app/src/main/java/com/pichillilorenzo/flutterwebviewexample/MainActivity.java

* `AppDelegate.swift` (iOS): https://github.com/pichillilorenzo/flutter_inappwebview/blob/master/example/ios/Runner/AppDelegate.swift

They both contain GeneratedPluginRegistrant.

@pichillilorenzo your example is showing only for java, how to do this with kotlin.

@pathak-harshal
Copy link

I am getting same error If I am hitting same url on second time

This was referenced Jul 6, 2020
@gc986
Copy link

gc986 commented Aug 4, 2020

"I have the same problem with the current version (I use InAppWebView). "flutter clean" "flutter run" doesn't help. The same problem occurs when calling the "reload" command."

The problem was in our code. We did not work correctly with the widget graph. The widget is cool, thank you very much to the author! :)

@yusufferdogan
Copy link

how can we dispose the web view

@RajKavadia
Copy link

Putting Await before loadurl solved my issue.
It was a silly mistake I did. means that we might have forgotten somewhere in the code to put await. Check the loadurl method. Its future method. So we need to put the await before loading the url.

Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests