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

Attempt to invoke interface method 'io.flutter.plugin.common.BinaryMessenger io.flutter.plugin.common.PluginRegistry$Registrar.messenger #220

Closed
sky126 opened this issue Dec 12, 2019 · 17 comments

Comments

@sky126
Copy link

sky126 commented Dec 12, 2019

I create new project only add flutter_inappwebview

Flutter version: Flutter (Channel beta, v1.12.13+hotfix.6, on Microsoft Windows [Version 10.0.18363.476], locale zh-CN)

Plugin version: ^2.1.0+1

Stacktrace/Logcat

2019-12-12 20:11:53.794 9623-9623/com.example.diantui E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.diantui, PID: 9623
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.diantui/com.example.diantui.MainActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'io.flutter.plugin.common.BinaryMessenger io.flutter.plugin.common.PluginRegistry$Registrar.messenger()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'io.flutter.plugin.common.BinaryMessenger io.flutter.plugin.common.PluginRegistry$Registrar.messenger()' on a null object reference
at com.pichillilorenzo.flutter_inappwebview.InAppBrowser.(InAppBrowser.java:66)
at com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin.onAttachedToEngine(InAppWebViewFlutterPlugin.java:40)
at io.flutter.embedding.engine.FlutterEnginePluginRegistry.add(FlutterEnginePluginRegistry.java:125)
at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:15)
at com.example.diantui.MainActivity.configureFlutterEngine(MainActivity.kt:11)
at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:185)
at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:418)
at android.app.Activity.performCreate(Activity.java:7136)
at android.app.Activity.performCreate(Activity.java:7127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)

@sky126
Copy link
Author

sky126 commented Dec 12, 2019

ShimPluginRegistry shimPluginRegistry = new ShimPluginRegistry(binding.getFlutterEngine());
registrar = shimPluginRegistry.registrarFor("com.pichillilorenzo/flutter_inappwebview");
inAppBrowser = new InAppBrowser(registrar);

@sky126 sky126 mentioned this issue Dec 12, 2019
@tatsuyuki25
Copy link

same issue

@pichillilorenzo
Copy link
Owner

I'm working on it to use the new Java API for Flutter embedding v2

@fulus06
Copy link

fulus06 commented Dec 23, 2019

@appstute-pratik
Copy link

appstute-pratik commented Dec 25, 2019

Same issue, Any work around?

@asdfgh5889
Copy link

Same issue, Any work around?

Getting dependency directly from git solved the problem. I think in couple days this fix will be released.

  flutter_inappwebview:
    git:
      url: https://github.com/pichillilorenzo/flutter_inappwebview.git
      ref: master

@MostafaEisam
Copy link

Same issue

@appstute-pratik
Copy link

Same issue, Any work around?

Getting dependency directly from git solved the problem. I think in couple days this fix will be released.

  flutter_inappwebview:
    git:
      url: https://github.com/pichillilorenzo/flutter_inappwebview.git
      ref: master

Is this fix safe for production build?

@asdfgh5889
Copy link

Same issue, Any work around?

Getting dependency directly from git solved the problem. I think in couple days this fix will be released.

  flutter_inappwebview:
    git:
      url: https://github.com/pichillilorenzo/flutter_inappwebview.git
      ref: master

Is this fix safe for production build?

I'm not completely sure, but should be ok

@sidpram
Copy link

sidpram commented Jan 15, 2020

Same issue, Any work around?

Getting dependency directly from git solved the problem. I think in couple days this fix will be released.

  flutter_inappwebview:
    git:
      url: https://github.com/pichillilorenzo/flutter_inappwebview.git
      ref: master

Is this fix safe for production build?

I'm not completely sure, but should be ok

If we include flutter_inappwebview as
flutter_inappwebview:
git:
url: https://github.com/pichillilorenzo/flutter_inappwebview.git
ref: master

Then it gives error on onPermissionRequest and initialOptions. Unable to resolve these two functions

@espresso3389
Copy link

I have a plugin depending on the module and pub.dev does not allow me to release a plugin that depends on github; the workaround does not work for me :(
Any ETA for a new release?

Getting dependency directly from git solved the problem. I think in couple days this fix will be released.

  flutter_inappwebview:
    git:
      url: https://github.com/pichillilorenzo/flutter_inappwebview.git
      ref: master

@lehno
Copy link

lehno commented Apr 20, 2020

Any fix on it, cant get this to work

@soulduse
Copy link

Still not working..

@PhanHug93
Copy link

In InAppWebViewFlutterPlugin.class i fixed:

 public InAppWebViewFlutterPlugin(PluginRegistry.Registrar registrar) {
        this.registrar = registrar;
    }

In GeneratedPluginRegistrant class i fixed:
flutterEngine.getPlugins().add(new com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin(shimPluginRegistry.registrarFor("com.pichillilorenzo/flutter_inappwebview")));
Code work but it's only local code ..

@alexlovar
Copy link

Same issue, Any work around?

Getting dependency directly from git solved the problem. I think in couple days this fix will be released.

  flutter_inappwebview:
    git:
      url: https://github.com/pichillilorenzo/flutter_inappwebview.git
      ref: master

same error here, this works for me. thanks

@pichillilorenzo
Copy link
Owner

It has been fixed with version 3.0.0+.
@alexlovar you shouldn't use the master branch anymore.

This was referenced Jul 6, 2020
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 Nov 11, 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

Successfully merging a pull request may close this issue.