question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React Native Android app that uses websockets is crashing as webview is not loaded

See original GitHub issue

Environment

Run react-native info in your terminal and paste its contents here. React Native Environment Info: System: OS: Windows 10 CPU: x64 Intel® Core™ i7-7820HQ CPU @ 2.90GHz Memory: 8.46 GB / 31.81 GB Binaries: Yarn: 1.9.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD IDEs: Android Studio: Version 3.1.0.0 AI-173.4907809

Description

Describe your issue in detail. Include screenshots if needed. If this is a regression, let us know. React native app with WebSockets runs fine on Android Virtual Device, but fails with following error message stack trace on physical android device.Not sure why WebView is in the picture here as I dont explicitly use it anywhere in the code

" This error can also happen due to a require() error during initialization or failure to call AppRegistry.registerComponent. E/WebViewFactory: Chromium WebView package does not exist"

“android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed”

Caused by: android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed at android.webkit.WebViewFactory.getWebViewContextAndSetProvider(WebViewFactory.java:319) at android.webkit.WebViewFactory.getProviderClass(WebViewFactory.java:383) at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:194) at android.webkit.CookieManager.getInstance(CookieManager.java:39) at com.facebook.react.modules.network.ForwardingCookieHandler.getCookieManager(ForwardingCookieHandler.java:161) at com.facebook.react.modules.network.ForwardingCookieHandler.get(ForwardingCookieHandler.java:59) at okhttp3.JavaNetCookieJar.loadForRequest(JavaNetCookieJar.java:59) at com.facebook.react.modules.network.ReactCookieJarContainer.loadForRequest(ReactCookieJarContainer.java:42) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:84) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:147) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764)

Reproducible Demo

Any React native project using standard out of box websockets. React native app deployed to device using command “react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res && react-native run-android”

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dryganetscommented, Nov 21, 2018

react-native uses okhttp WebSockets. The problem root cause is that your device is missing WebView for some reason.

react-native replaces okhttp cookies manager with the android’s ForwardingCookieManager which relies on WebView. (Probably to share the cookies with WebView?)

We are seeing this crash in production too. There is only a small fraction of devices have no WebView.

0reactions
cpojercommented, Mar 19, 2019

This issue has been moved to react-native-community/react-native-webview#432.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native - Failed to load WebView provider - Stack Overflow
This crash has been fixed in react-native master around April end 2019. To fix this issue you need to upgrade to react-native version...
Read more >
Headless JS - React Native
Headless JS is a way to run tasks in JavaScript while your app is in the background. It can be used, for example,...
Read more >
BlackBerry Dynamics SDK for React Native version 10.1
SQLite demonstrates how to use a secure SQLite DB instance in a React Native app. UnitTest runs Jasmine unit tests for fetch, XMLHttpRequest,...
Read more >
Untitled
react : assign initialListSize if not undefined (8634501) ... android: WebView backgroundColor not working (07e4dd2) ... core: fix mutex crash (de3dad1) ...
Read more >
React Native - Datadog Docs
Debugging crashes faster by unifying client-side and server-side metrics, traces, and logs; Unifying full-stack monitoring in a single platform for frontend and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found