我正在使用react native(expo),并尝试使用网络视图package 而且我在控制台中收到此警告,并且在移动屏幕上什么也没看到。
“ sdkVersion”:“ 36.0.0”,
“博览会”:“〜36.0.0”,
“ react-native”:“ https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz”,
“ react-native-webview”:“ ^ 8.0.2”,
错误:
遇到错误加载页面,对象{ “ canGoBack”:否, “ canGoForward”:否, “代码”:-1, “ description”:“ net :: ERR_CACHE_MISS”, “正在加载”:false, “目标”:2665, “ title”:“”, “ url”:“ https://facebook.github.io/react-native/”, } -console.warn中的node_modules \ react-native \ Libraries \ YellowBox \ YellowBox.js:71:8 -警告中的node_modules \ expo \ build \ environment \ muteWarnings.fx.js:18:23 * http://192.168.1.100:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:209150:21在onLoadingError中 -invokeGuardedCallbackImpl中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:307:15 -invokeGuardedCallback中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:531:36 -invokeGuardedCallbackAndCatchFirstError中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:555:30
-executeDispatch中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:722:42 * http://192.168.1.100:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:209150:21在onLoadingError中 -invokeGuardedCallbackImpl中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:307:15 -invokeGuardedCallback中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:531:36 -invokeGuardedCallbackAndCatchFirstError中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:555:30 -executeDispatch中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:722:42 -executeDispatchesInOrder中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:744:20 -executeDispatchesAndRelease中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:907:29 -forEachAccumulated中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:889:12 -runEventsInBatch中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:932:21 -runExtractedPluginEventsInBatch中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:1096:19 -批处理更新$ argument_0中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:2796:6 -在batchedUpdates $ 1中,node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:18791:14 -在batchedUpdates中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:2709:30 -批处理更新$ argument_0中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:2794:17 -receiveEvent中的node_modules \ react-native \ Libraries \ Renderer \ implementations \ ReactNativeRenderer-dev.js:2814:26 -__callFunction中的node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:436:47 -__guard $ argument_0中的node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:111:26 -__guard中的node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:384:10 -__guard $ argument_0中的node_modules \ react-native \ Libraries \ BatchedBridge \ MessageQueue.js:110:17 * [本地代码]:callFunctionReturnFlushedQueue中为空
答案 0 :(得分:0)
我假设这是在较旧的Android设备上发生的吗?较新的Android设备应该不会出现此问题,Expo的工作已进行了修复,但目前尚无确切的时间表。最好的建议是在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的Samsung 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
如果其中任何一个回购解决了该问题,我都会更新此答案。
如本演示所示,它确实可以在Android模拟器上运行:https://snack.expo.io/@wodin/webview-example