javascript - react native (博览会) WebView 错误 net::ERR_CACHE_MISS

标签 javascript reactjs react-native webview expo

我正在使用 react native(expo) 并尝试使用 web View package
我在控制台中收到此警告,但在移动屏幕上没有看到任何内容。

"sdkVersion": "36.0.0",

"expo": "~36.0.0",

"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",

"react-native-webview": "^8.0.2",



错误:

Encountered an error loading page, Object { "canGoBack": false, "canGoForward": false, "code": -1, "description": "net::ERR_CACHE_MISS", "loading": false, "target": 2665, "title": "", "url": "https://facebook.github.io/react-native/", } - node_modules\react-native\Libraries\YellowBox\YellowBox.js:71:8 in console.warn - node_modules\expo\build\environment\muteWarnings.fx.js:18:23 in warn * http://192.168.1.100:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:209150:21 in onLoadingError - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:307:15 in invokeGuardedCallbackImpl - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:531:36 in invokeGuardedCallback - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:555:30 in invokeGuardedCallbackAndCatchFirstError
- node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:722:42 in executeDispatch * http://192.168.1.100:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:209150:21 in onLoadingError - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:307:15 in invokeGuardedCallbackImpl - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:531:36 in invokeGuardedCallback - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:555:30 in invokeGuardedCallbackAndCatchFirstError - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:722:42 in executeDispatch - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:744:20 in executeDispatchesInOrder - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:907:29 in executeDispatchesAndRelease - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:889:12 in forEachAccumulated - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:932:21 in runEventsInBatch - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:1096:19 in runExtractedPluginEventsInBatch - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:2796:6 in batchedUpdates$argument_0 - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:18791:14 in batchedUpdates$1 - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:2709:30 in batchedUpdates - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:2794:17 in batchedUpdates$argument_0 - node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:2814:26 in receiveEvent - node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:436:47 in __callFunction - node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:111:26 in __guard$argument_0 - node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:384:10 in __guard - node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:110:17 in __guard$argument_0 * [native code]:null in callFunctionReturnFlushedQueue

最佳答案

我假设您在较旧的 Android 设备上会发生这种情况?较新的 Android 设备不应该有这个问题,世博会正在修复这个问题,但目前还没有确定的时间表。最好的建议是在 iOS 设备、模拟器上开发,或者构建 APK,你应该能够在旧设备上加载它而没有问题。
“看起来这是一个上游 Android 问题,在 androidx.appcompat:appcompat:1.2.0 中已解决,目前我们仍在使用 1.1.0
由于 1.2.0 仍处于 alpha 阶段,等待它成为稳定版本可能是个好主意”
https://github.com/expo/expo/issues/6665#issuecomment-571623759
看起来截至 4 月 16 日 1.2.0 已发布,但世博会还没有关于何时推出的消息。https://github.com/expo/expo/issues/6665#issuecomment-614451492
注意:我在运行 Android 5.1.1 Lollipop 的三星 Galaxy Tab 4 上遇到了同样的问题。这使用隧道、LAN 或本地连接模式发生。
一位用户确认“WebView Android 版本 5.0 不起作用(Android 版本 8-10 没有任何问题)”https://forums.expo.io/t/webview-unable-to-load-url-got-error-err-cache-miss/40011/3
如果其中任何一个 repo 解决了该问题,我将更新此答案。
正如您在此演示中看到的,它确实可以在 Android 模拟器上运行:https://snack.expo.io/@wodin/webview-example

关于javascript - react native (博览会) WebView 错误 net::ERR_CACHE_MISS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59692110/

相关文章:

javascript - 请简单解释我何时/为什么需要使用 bind()

react-native - Expo 不适用于 firebase 模拟器

django - 与 Django Channels 的 React native Websocket 连接已打开,但没有消息通过

ios - React Native 和 RNFirebase iOS 发布版本失败

javascript - 使用jquery php回调唯一的文件名

javascript - 下拉菜单显示,但当我单击它时没有任何反应,有人可以告诉我为什么吗?

javascript - nodeJS : Promise executing before for loop finishes, 回调栈

css - 移除输入的蓝色轮廓颜色

reactjs - 将文件类型转换为数据 URI - React-Dropzone

javascript - react 来自 child 的父访问状态