失败:构建失败并出现异常。
Execution failed for task ':react-native-gesture-handler:compileDebugKotlin'。执行 org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction 时发生失败 编译错误。查看日志了解更多详情
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
Run Code Online (Sandbox Code Playgroud)
[
3m 54s 内构建失败
at makeError (C:\Users\Zsola\Desktop\NoruHotels\node_modules\execa\index.js:174:9)
at C:\Users\Zsola\Desktop\NoruHotels\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (C:\Users\Zsola\Desktop\NoruHotels\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\Zsola\Desktop\NoruHotels\node_modules\@react-native-community\cli\build\index.js:192:9)
Run Code Online (Sandbox Code Playgroud)
info 运行 CLI 以--verbose flag获取更多详细信息。
我用ai尝试过这个
当 React-native-gesture-handler 库的 Kotlin 编译过程出现问题时,会出现此错误。您可以采取以下一些步骤来解决该问题:
确保您安装了正确版本的 Kotlin Gradle 插件。您可以在项目的 build.gradle 文件的依赖项下检查版本。
尝试通过在项目目录中运行以下命令来清理和重建项目:
cd android
./gradlew clean
cd ..
react-native run-android
Run Code Online (Sandbox Code Playgroud)
ext.kotlin_version = '1.5.21'
然后更新 Kotlin Gradle 插件版本以匹配:
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
configurations.all {
exclude group: 'com.facebook.react', module: 'react-native-gesture-handler'
}
Run Code Online (Sandbox Code Playgroud)
然后再跑react-native run-android。
希望这些步骤之一能够为您解决问题。
小智 7
我通过将react-native-gesture-handler升级到版本2.9.0解决了这个问题。
更新package.json:
打开项目的package.json文件并找到the dependency for react-native-gesture-handler. 将版本号更改为“2.9.0”(不要忘记删除^)。它应该看起来像这样:
"dependencies": {
"react-native-gesture-handler": "2.9.0",
// other dependencies...
}
Run Code Online (Sandbox Code Playgroud)
卸载该node_modules文件夹。
跑步npm install
立即尝试构建您的项目
| 归档时间: |
|
| 查看次数: |
19704 次 |
| 最近记录: |