You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

react-native-screens:compileDebugKotlin编译失败问题求助

React Native 编译错误::react-native-screens:compileDebugKotlin 失败

问题详情

编译项目时触发如下错误:

> Task :react-native-screens:compileDebugKotlin FAILED

* What went wrong:
Execution failed for task ':react-native-screens:compileDebugKotlin'.
> Compilation error. See log for more details

已尝试过相关issue的解决方案但无效,当前版本信息:

"react-native": "0.61.5"
"react-native-screens": "^3.18.2"

可行解决方案

  • 降级react-native-screens版本
    RN 0.61.x版本与react-native-screens@3.x存在兼容性冲突,最高适配2.15.0版本,执行命令降级:

    npm install react-native-screens@2.15.0 --save
    # 用yarn的话执行:yarn add react-native-screens@2.15.0
    
  • 清理缓存并重构项目
    执行以下命令清除各类缓存后重新构建:

    npm cache clean --force
    npx react-native start --reset-cache
    cd android && ./gradlew clean && cd ..
    npx react-native run-android
    
  • 确认Kotlin版本匹配
    RN 0.61.5默认依赖Kotlin 1.3.50,打开android/build.gradle文件,检查并修改Kotlin版本配置:

    buildscript {
        ext {
            kotlinVersion = "1.3.50"
        }
        dependencies {
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
        }
    }
    

内容的提问来源于stack exchange,提问作者Tafsir Ahamed

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.13 18:41:05