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

android 5.1.1 and simulator, WebView error on SDK36 and Exponent_2.14 #6665

Closed
Magrider opened this issue Jan 3, 2020 · 18 comments
Closed

Comments

@Magrider
Copy link

Magrider commented Jan 3, 2020

Expo CLI 3.4.1 environment info:
System:
OS: Windows 10
Binaries:
Yarn: 1.19.1 - C:\Users\Administrator\AppData\Roaming\npm\yarn.CMD
npm: 6.9.0 - D:\Program Files\nodejs\npm.CMD

Android: real device: V5.1.1, simulator(nox): V5.1.1500190725
expo Client: 2.14.0
SDK: 36
error happen on expo client and standalone android

note: webview working fine on SDK 35 and expo client 2.13 only, 2.14 will shows String resource ID #0x2040003 on real device.

Steps to Reproduce

  1. expo upgrade
  2. change WebView from 'react-native' to 'react-native-WebView'
  3. yarn start
  4. enter Webview Page, error happen

Expected Behavior

It should render a webview page.

Actual Behavior

On my android simulator(nox), which is android V5.1.1500190725, it will shows
net::ERR_CACHE_MISS.
I found this open issue on react-native-webview,
react-native-webview/react-native-webview#1101
and still waiting reply.
Then I tried to run on my real device, the error becomes String resource ID #0x2040003

IMG_20200103_103038
IMG_20200103_103108

After I search the 0x2040003 error on google, it seems like this is a common issue on android V5.1.1 with context, however for some reasons, I have to use V5.1.1.

I downgrade my sdk to 35, and it shows same error, until I reinstall expo client 2.13, WebView works fine.

Reproducible Demo

<WebView source={{ uri: 'google.com', }} onNavigationStateChange={this.onNavigationStateChange} startInLoadingState // scalesPageToFit javaScriptEnabled style={{ flex: 1, paddingTop: StatusBar.currentHeight }} />

Thank you!

@Magrider Magrider added the bug label Jan 3, 2020
@cruzach
Copy link
Contributor

cruzach commented Jan 3, 2020

Can you try this in a bare react native project? If the same error occurs there, then this is probably an issue specific to react-native-webview, and not Expo

@cruzach cruzach added Android needs more info To be used when awaiting reporter response labels Jan 3, 2020
@Magrider
Copy link
Author

Magrider commented Jan 4, 2020

Can you try this in a bare react native project? If the same error occurs there, then this is probably an issue specific to react-native-webview, and not Expo

Hi Cruzach,
I just made a bare react native project and it works fine on both Simulator and real device.
"dependencies": {
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-webview": "^8.0.2"
},

Thanks!

It seems like the problem happen on using Expo client 2.14.0(supported SDKs:33,34,35,36) and standalone app on sdk 36.
The working version for me on android V5.1.1 is Expo client 2.13.0(supported SDKs:33,34,35).

@mikailcetinkaya
Copy link

same problem , any advice ?
Any work Around ?

@cruzach
Copy link
Contributor

cruzach commented Jan 6, 2020

Tested this myself on more recent versions of Android and WebView seems to be working fine. So this looks to only affect Android 5? although I'm not sure why

@Magrider
Copy link
Author

Magrider commented Jan 7, 2020

Tested this myself on more recent versions of Android and WebView seems to be working fine. So this looks to only affect Android 5? although I'm not sure why

Hi Cruzach,
Definitely this issue happen on android 5.1(or 5?), I found 2 same issues on stackoverflow:
https://stackoverflow.com/questions/46810118/exception-on-new-webview-on-lollipop-5-1-devices
https://stackoverflow.com/questions/41025200/android-view-inflateexception-error-inflating-class-android-webkit-webview
any idea? Thanks for your help

@cruzach
Copy link
Contributor

cruzach commented Jan 7, 2020

Looks like this was an upstream Android issue, which is solved in androidx.appcompat:appcompat:1.2.0, currently we still use 1.1.0

Since 1.2.0 is still in alpha, it might be a good idea to wait for it to be a stable release

@npedrini
Copy link

It looks like 1.2.0 came out of alpha yesterday. Any ideas when this will be folded into Expo?

https://developer.android.com/jetpack/androidx/releases/core

@026binit
Copy link

026binit commented Nov 6, 2020

looking for solutions

expo sdk :- 39
plaform :- Android 5.1.1

@kamalpandey
Copy link

+1

bbarthec added a commit that referenced this issue Nov 16, 2020
# Why
Might help resolving: #6665
I've failed in reaching the working scenario, but still think this change is worth merging.

# How
Bumped androidx.appcomapat to version 1.2.0

# Test Plan
I was testing on Android simulator running Android 5.1
As I've described in #10999 every WebView opened in separate Activity (any managed app) other than the main one (home app) seems to be lacking Internet access. The only URLs working in managed app are either the URL that's already in the device cache or google.com 🤔

No breaking behaviour was observed 😊

# References
androidx.appcompat release notes
stackoverflow.com/questions/58028821/webview-crash-on-android-5-5-1-api-21-22-resourcesnotfoundexception-string-r
https://issuetracker.google.com/issues?q=err_cache_miss
issuetracker.google.com/issues/141351441
@026binit
Copy link

026binit commented Jan 14, 2021

issue not resolved, still looking for solutions

@JerryBels
Copy link

Still not resolved.

@brentvatne
Copy link
Member

@JerryBels - you need to provide more information than that. are you using the latest sdk? we updated androidx.appcompat to 1.2.0 already, so as far as i can tell this is an upstream android issue

@JerryBels
Copy link

With pleasure :)

Expo CLI 4.11.0 environment info:
    System:
      OS: Windows 10 10.0.21390
    Binaries:
      Node: 14.16.1 - C:\Program Files\nodejs\node.EXE
      npm: 6.14.12 - C:\Program Files\nodejs\npm.CMD
    IDEs:
      Android Studio: Version  4.2.0.0 AI-202.7660.26.42.7351085
    npmPackages:
      expo: ~42.0.1 => 42.0.3
      react: 16.13.1 => 16.13.1
      react-dom: 16.13.1 => 16.13.1
      react-native: https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz => 0.63.2
      react-native-web: ~0.13.12 => 0.13.18
    Expo Workflow: managed

For the webview:

    "react-native-webview": "11.6.2",

Ran it on an Android 5.1, and got the following error :

Encountered an error loading page, Object {
  "canGoBack": false,
  "canGoForward": false,
  "code": -1,
  "description": "net::ERR_CACHE_MISS",
  "loading": false,
  "target": 115,
  "title": "Page Web non disponible",
  "url": "https://google.com",
}
at node_modules\react-native\Libraries\LogBox\LogBox.js:117:10 in registerWarning
at node_modules\react-native\Libraries\LogBox\LogBox.js:63:8 in warnImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:36:4 in console.warn
at node_modules\expo\build\environment\react-native-logs.fx.js:18:4 in warn
at node_modules\react-native-webview\lib\WebView.android.js:146:12 in _this.getWebViewHandle
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:265:4 in invokeGuardedCallbackImpl
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:476:2 in invokeGuardedCallback
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:500:2 in invokeGuardedCallbackAndCatchFirstError
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:597:41 in executeDispatch
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:621:19 in executeDispatchesInOrder
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:2521:28 in executeDispatchesAndRelease
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:838:4 in forEachAccumulated
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:2546:20 in runEventsInBatch
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:2702:18 in runExtractedPluginEventsInBatch
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:2639:35 in batchedUpdates$argument_0
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:17712:13 in batchedUpdates$1
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:2492:29 in batchedUpdates
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:2638:16 in _receiveRootNodeIDEvent
at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:2713:25 in receiveEvent
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue

The app works perfectly on a few phones running Android 10/11, and on an emulator running Android 9. If there are more checks you wish me to perform, I will gladly.

@brentvatne
Copy link
Member

@JerryBels - based on react-native-webview/react-native-webview#1101 this seems to still be an upstream issue in react-native-webview

@JerryBels
Copy link

@brentvatne Okay so we need to wait for react-native-webview to do something (after more than 2 years?) ... I guess I will inform the client that Android 5.x can't be maintained.

@github-actions
Copy link
Contributor

This issue is stale because it has been open for 60 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

@github-actions github-actions bot added the stale label Jan 18, 2022
@brentvatne
Copy link
Member

closing because it looks like the related issue is closed on react-native-webview. also, with EAS Build you can use any version of react-native-webview that you like (although only the version supported by the SDK version that you are using will work inside of Expo Go)

@NoobMahbub
Copy link

I was facing the same error and here is how I fixed this issue

  1. Restarted my android device

  2. Removed the https:// from the url
    https://techhelpbd.com/gitdown was throwing this error when I removed https:// then it worked fine.

import * as React from 'react';
import { WebView } from 'react-native-webview';

export default function Browser() {
  return (
    <WebView
      source={{ uri: 'techhelpbd.com/gitdown' }}
    />
  );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants