我是android开发的新手,我正在着手开发一个新的android应用程序。我目前正在一个android studio模拟器中使用react-native-webview测试expo,同时等待我的雇主给我寄来合适的开发设备。我正在测试设置一个iframe,它在应用程序中呈现我们现有的站点,一切都很顺利,直到我尝试通过https连接到我的本地计算机上的站点。我在expos git页面上看到this issue说,他们把this fix引入了12月份发布的版本中,似乎对我来说,除了通过https连接到10.0.2.2之外,它在所有情况下都有效。我试过在android studio中启用“接受所有证书”选项,但似乎也没有解决这个问题。
这些代码片段都可以正常呈现
<WebView source={{ uri: 'https://www.google.com/' }} />
<WebView source={{ uri: 'http://10.0.2.2/website/' }} />
<WebView source={{ uri: 'https://{alphaenvironment}.com/website/' }} />而下面的代码返回"SSL错误:证书颁发机构不受信任“
<WebView source={{ uri: 'https://10.0.2.2/website/' }} />这是我的包json
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject",
"test": "jest --watchAll"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/vector-icons": "^12.0.0",
"@react-native-community/masked-view": "0.1.10",
"@react-navigation/bottom-tabs": "5.11.2",
"@react-navigation/native": "~5.8.10",
"@react-navigation/stack": "~5.12.8",
"expo": "~40.0.0",
"expo-asset": "~8.2.1",
"expo-constants": "~9.3.0",
"expo-font": "~8.4.0",
"expo-linking": "~2.0.0",
"expo-splash-screen": "~0.8.0",
"expo-status-bar": "~1.0.3",
"expo-web-browser": "~8.6.0",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
"react-native-gesture-handler": "~1.8.0",
"react-native-inappbrowser-reborn": "^3.5.1",
"react-native-safe-area-context": "3.1.9",
"react-native-screens": "~2.15.0",
"react-native-web": "~0.13.12",
"react-native-webview": "^11.0.0"
},
"devDependencies": {
"@babel/core": "~7.9.0",
"@types/react": "~16.9.35",
"@types/react-native": "~0.63.2",
"jest-expo": "~40.0.0",
"typescript": "~4.0.0"
},
"private": true
}有谁能帮助这个菜鸟吗?
发布于 2021-08-23 01:41:15
使用ipconfig命令检查计算机的ip,如果是windows,则使用ipconfig;如果是linux,则使用ifconfig,并将10.0.2.2替换为
https://stackoverflow.com/questions/66320436
复制相似问题