执行任务失败:react-native-native-webview:compiledebugkotlin'
在使用RN更新助手使用RN更新后,Gradle CH build build build app将REACT本地升级为0.61.2。获取此错误
故障:构建失败而异常。
- 出了什么问题: 执行失败的任务':react-native-webview:compiledebugkotlin'。
java.io.ioexception:拒绝权限
尝试所有React-Native-webview版本,但结果是相同的。
当我删除“ react-native-webview”:“^8.0.3”该行中的该行
。
- “ react”:“ 17.0.2”,
- “ react-native”:“ 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
android/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
After upgrading react native from 0.61.2 to 0.68.2 with RN update helper, gradle cant build app. Getting this error
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':react-native-webview:compileDebugKotlin'.
java.io.IOException: Permission denied
trying all react-native-webview versions but result is same.
when i removeing "react-native-webview": "^8.0.3" this line from package.json file then build successfully goes but app getting error because this dependency used in app
below dependency versions which i using.
- "react": "17.0.2",
- "react-native": "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
android/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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
如果您从2022年11月4日开始面对问题,
React-native> = 0.63且低于0.67 。
修复了
Android/buld.gradle.gradle
的 文件,此修复程序将要做的是应用一个排除的分辨率规则,该规则将迫使React Antial Android库的分辨率使用node_modules内部。
一旦您更新应用程序以对本机V0.71.0进行反应,则将不再需要此修复程序。
修复了较旧的反应(< 0.63)
上面的修复仅适用于Gradle 6.2及更高的固定。较旧的反应生物使用了较旧的gradle。
您可以通过查看/android/gradle/warpper/gradle-wrapper.properties 文件。
如果您使用Gradle版本6.1或以下的较旧的反应本地(例如0.63或更早),则必须在此处使用其他解决方法,请在此处详细介绍:#35210(评论)
上述解决方案,为您工作,然后尝试这个。
在
android/buld.gradle
文件中If you face the issue from Nov 4th 2022,
Fix for react-native >= 0.63 and lower than 0.67
In
android/buld.gradle
file,What this fix will do is apply an exclusiveContent resolution rule that will force the resolution of React Native Android library, to use the one inside node_modules.
Once you update your app to React Native v0.71.0, this fix won't be needed anymore.
Fix for older react-native (< 0.63)
The fix above only works on gradle 6.2 and higher. Older react-native used older gradle.
You may determine your gradle version by looking in your /android/gradle/wrapper/gradle-wrapper.properties file.
If you are on older react-native (for example 0.63 or earlier) that uses gradle version 6.1 or below, you must use a different workaround, detailed here: #35210 (comment)
Updated On Nov 11th 2022
If the above solution is not working for you then try this one.
In
android/buld.gradle
file,在
android/buld.gradle
文件中,您必须指定kotlinversion
到“ 1.6.0”In
android/buld.gradle
file you have to specifykotlinVersion
to "1.6.0"尝试在Android文件夹上运行此命令。
sudo ./gradlew compiledebugkotlin
这对我有用。
Try running this command on the android folder.
sudo ./gradlew compileDebugKotlin
This worked for me.
如果您不想在项目中使用,请通过卸载lib不仅从软件包
删除
中
。 用于Android的豆荚和重新安装豆荚
:
删除构建并重建它
希望它有效!
If you don't want to use in your project then remove it by uninstall lib not only from package.json
If you want to use then, Please Update it to latest version of it:
For ios:
delete pods and reinstall pods
For Android:
delete build and rebuild it
Hope it works!
上网您的React本地版本可以正常工作
0.63.x至0.63.5
0.65.x至0.65.3
0.66.x至0.66.5
0.68.x至0.68.5
0.69.x至0.69.7
0.70.x至0.70.5
Upgarding your react native version can work
0.63.x to 0.63.5
0.65.x to 0.65.3
0.66.x to 0.66.5
0.68.x to 0.68.5
0.69.x to 0.69.7
0.70.x to 0.70.5
您可以在Android/build.gradle文件中尝试以下设置
You can try the below setting inside android/build.gradle file
我正在使用React-Native版本0.64.0,然后基于 this ,我升级到0.64.4,现在一切都很好。
这是该问题解决方案的有用部分:
I was using react-native version 0.64.0, then based on this issue, I upgraded to 0.64.4 and everything is fine now.
this is the useful part of the issue's solution: