使用 RN 更新助手將 react native 從 0.61.2 升級到 0.68.2 后,gradle 無法構建應用程式。收到此錯誤
FAILURE:構建失敗并出現例外。
- 出了什么問題:任務':react-native-webview:compileDebugKotlin'執行失敗。
java.io.IOException:權限被拒絕
嘗試所有 react-native-webview 版本,但結果相同。
當我從 package.json 檔案中洗掉 "react-native-webview": "^8.0.3" 這一行時,構建成功但應用程式出錯,因為應用程式中使用了此依賴項
下面是我使用的依賴版本。
- “反應”:“17.0.2”,
- “反應原生”:“0.68.2”,
- "@babel/core": "^7.12.9",
- "@babel/runtime": "^7.12.5",
- "@react-native-community/eslint-config": "^2.0.0",
- "babel-jest": "^26.6.3",
- "eslint": "^7.32.0",
distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-all.zip
安卓/build.gralde
buildscript {
ext {
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64
ndkVersion = "24.0.8215888"
} else {
// Otherwise we default to the side-by-side NDK version from AGP.
ndkVersion = "21.4.7075529"
}
}
dependencies {
classpath("com.android.tools.build:gradle:7.0.4")
classpath 'com.google.gms:google-services:4.3.8'
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:4.1.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
uj5u.com熱心網友回復:
嘗試在 android 檔案夾上運行此命令。
sudo ./gradlew compileDebugKotlin
這對我有用。
uj5u.com熱心網友回復:
如果您不想在專案中使用,請通過卸載 lib 將其洗掉,而不僅僅是從 package.json
npm uninstall react-native-webview
如果您想使用,請將其更新到最新版本:
"react-native-webview": "^11.17.2",
對于 iOS:
洗掉 pod 并重新安裝 pod
cd ios && pod install
對于 Android: 洗掉構建并重建它
希望它有效!
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/480788.html
標籤:安卓 反应式 毕业典礼 网页浏览 反应本机webview
