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

Install flutter_inappwebview: ^2.1.0+1 Android project crashes #260

Closed
zboboan opened this issue Jan 15, 2020 · 12 comments
Closed

Install flutter_inappwebview: ^2.1.0+1 Android project crashes #260

zboboan opened this issue Jan 15, 2020 · 12 comments
Labels

Comments

@zboboan
Copy link

zboboan commented Jan 15, 2020

Environment

Android

Flutter version:
Flutter:1.12.13+hotfix.5

Android version:
Android 9.0

Description

After installing flutter_inappwebview: ^2.1.0+1, the project crashed when running. After debugging on the simulator, an error was reported as "Could not update files on device: HttpException: Connection closed before full header was received". After several versions were changed, no error was reported But it still collapses

@heshaShawky
Copy link

Same issue here too

@wwwdata
Copy link
Contributor

wwwdata commented Jan 16, 2020

I also have this problem on a fresh flutter project with version: Flutter 1.12.13+hotfix.5

Here is the stacktrace that was logged in adb shell:

01-16 13:02:40.772 17111 17111 E AndroidRuntime: FATAL EXCEPTION: main
01-16 13:02:40.772 17111 17111 E AndroidRuntime: Process: com.example.webview_newtest, PID: 17111
01-16 13:02:40.772 17111 17111 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.webview_newtest/com.example.webview_newtest.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
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:107)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:214)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7356)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
01-16 13:02:40.772 17111 17111 E AndroidRuntime: 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
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at com.pichillilorenzo.flutter_inappwebview.InAppBrowser.<init>(InAppBrowser.java:66)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin.onAttachedToEngine(InAppWebViewFlutterPlugin.java:40)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at io.flutter.embedding.engine.FlutterEnginePluginRegistry.add(FlutterEnginePluginRegistry.java:125)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:15)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at com.example.webview_newtest.MainActivity.configureFlutterEngine(MainActivity.kt:10)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:185)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:418)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:7802)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:7791)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
01-16 13:02:40.772 17111 17111 E AndroidRuntime:        ... 11 more

@wwwdata
Copy link
Contributor

wwwdata commented Jan 17, 2020

as already mentioned in other issues. The plugin system of flutter changed and if you are on the latest version, install from the master branch. Fixes will only be available when version 3.0 is officially released. I am running on the master branch now and everything works fine!

@polilluminato
Copy link

@wwwdata so you're telling me we have to clone the repo and not download the plugin like usual from pub.dev and insert flutter_inappwebview in the dependencies section?

@wwwdata
Copy link
Contributor

wwwdata commented Jan 18, 2020

Yes. You can import from a git repo. It is described here https://flutter.dev/docs/development/packages-and-plugins/using-packages#dependencies-on-unpublished-packages

@polilluminato
Copy link

polilluminato commented Jan 18, 2020

Yes. You can import from a git repo. It is described here https://flutter.dev/docs/development/packages-and-plugins/using-packages#dependencies-on-unpublished-packages

Yeah! If I add in the pubspec.yaml this:

flutter_inappwebview:
    git:
      url: git@github.com:pichillilorenzo/flutter_inappwebview.git

instead of:

flutter_inappwebview: ^2.1.0+1

the app runs well!

Thank you so much @wwwdata

@zboboan
Copy link
Author

zboboan commented Jan 19, 2020

是。您可以从git仓库导入。它在这里描述https://flutter.dev/docs/development/packages-and-plugins/using-packages#dependencies-on-unpublished-packages

Thank you so much

@2x2xplz
Copy link

2x2xplz commented Feb 6, 2020

Thanks very much @wwwdata and @polilluminato

However I am getting

git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I'm able to clone the repo from the command line, although I am asked for my passphrase. I can also download a ZIP or clone from github. But the seamless install as @polilluminato describes is not successful.
I'm on Windows.

@polilluminato
Copy link

Thanks very much @wwwdata and @polilluminato
...
I'm able to clone the repo from the command line, although I am asked for my passphrase. I can also download a ZIP or clone from github. But the seamless install as @polilluminato describes is not successful.
I'm on Windows.

Try with

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

instead of

url: git@github.com:pichillilorenzo/flutter_inappwebview.git

I read on other repos that some Windows users fix the issue in this way, I'm on Linux so I cannot try but maybe It works for you.

@2x2xplz
Copy link

2x2xplz commented Feb 7, 2020

Thanks again @polilluminato , that did work. Should have thought of it myself as https:// is how we download ZIP or clone the repo anyway. For future viewers, the full entry in pubspec.yaml is

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

It is also possible to clone or download a ZIP (then unzip) and use the local copy:

  flutter_inappwebview:
    path: C:/path/to/this/repo/flutter_inappwebview

(note that backslashes, or double-backslashes, don't work)

One final comment: if simply adding this package normally will automatically crash the app (which is why we're all here), a link to this issue should be highlighted on the front-page README.

This was referenced Jul 6, 2020
Copy link

github-actions bot commented Oct 7, 2024

This issue is stale and has been automatically closed because it has been open for more than 365 days with no activity. Please reopen a new issue if you still have it.

@github-actions github-actions bot added the stale label Oct 7, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2024
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 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants