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 virtual method 'java.util.Set java.util.HashMap.entrySet()' on a null object reference #367

Closed
Doflatango opened this issue May 28, 2020 · 2 comments

Comments

@Doflatango
Copy link
Contributor

Environment

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.1, on Microsoft Windows [Version 10.0.19041.264], locale zh-CN)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Android Studio (version 3.6)
[✓] VS Code (version 1.45.1)
[✓] Connected device (1 available)

• No issues found!

Flutter version: Channel stable, v1.17.1
Plugin version: 3.2.0
Android version: Oxygen OS
Device information: OnePlus 7pro

Description

Expected behavior:

Current behavior:
Attempt to invoke virtual method 'java.util.Set java.util.HashMap.entrySet()' on a null object reference

Steps to reproduce

class _HeadlessWebViewState extends State<HeadlessWebView> {
  HeadlessInAppWebView headlessInAppWebView;

  @override
  void initState() {
    super.initState();

    headlessInAppWebView = HeadlessInAppWebView(
      onWebViewCreated: (InAppWebViewController controller) {
        print('========= webview created');
      },
      initialUrl: 'https://google.com/',
      onLoadStop: (controller, url) async {
        print("========= onLoadStop $url");
      },
    );
  }

  @override
  void dispose() {
    headlessInAppWebView.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: FlatButton(
          child: Text('Run'),
          onPressed: () async {
            await headlessInAppWebView.dispose();
            await headlessInAppWebView.run();
          },
        ),
      ),
    );
  }
}

Stacktrace/Logcat

E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): Failed to handle method call
E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Set java.util.HashMap.entrySet()' on a null object reference
E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): 	at com.pichillilorenzo.flutter_inappwebview.InAppWebView.InAppWebViewOptions.parse(InAppWebViewOptions.java:92)
E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): 	at com.pichillilorenzo.flutter_inappwebview.InAppWebView.FlutterWebView.<init>(FlutterWebView.java:61)
E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): 	at com.pichillilorenzo.flutter_inappwebview.HeadlessInAppWebViewManager.createHeadlessWebView(HeadlessInAppWebViewManager.java:74)
E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): 	at com.pichillilorenzo.flutter_inappwebview.HeadlessInAppWebViewManager.onMethodCall(HeadlessInAppWebViewManager.java:59)
E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:226)
E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:631)
E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): 	at android.os.MessageQueue.next(MessageQueue.java:336)
E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): 	at android.os.Looper.loop(Looper.java:174)
E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): 	at android.app.ActivityThread.main(ActivityThread.java:7695)
E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
E/MethodChannel#com.pichillilorenzo/flutter_headless_inappwebview(18654): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
@pichillilorenzo
Copy link
Owner

New version 3.3.0 released!

@Doflatango
Copy link
Contributor Author

It works now!
Thanks!

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

2 participants