2023-02-13 Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
注:
Rn:(react-nativ)
as:(android studio)
电脑:win10
测试环境:Android
在新电脑用as跑一下老项目,报错:Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.6.0, expected version is 1.1.15.
翻译:模块是用不兼容的Kotlin版本编译的。其元数据的二进制版本为1.6.0,预期版本为1.1.15。
踩坑(可忽略不看):
1、更新Rn版本。kotlin需要1.1.15版本,而我已经安装了1.6.0版本,我没有去卸载kotlin,然后再安装1.1.15,而是直接更新了Rn(事实上我不会卸载kotlin,因为我压根不知道它在哪);
更新Rn是因为别的网友给我提供的方案,我照做了,然并卵,我把 Rn 0.64.2 升级 到了 ^0.71.2,用as再跑一下,结果build failed。
我强烈建议非必要不更新Rn,我又把它的版本给恢复了 0.64.2。
2、更新kotlin版本。然并卵。
3、(解决方案):请不要降低kotlin的版本,它说它想要1.1.15版本,而你已经是1.6.0了,那么请你在项目的build.gradle文件中的buildscript对象中添加一行代码:
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext { buildToolsVersion = "29.0.3" minSdkVersion = 21 compileSdkVersion = 31 targetSdkVersion = 29 ndkVersion = "20.1.5948944" kotlin_version = '1.6.0' // ❗🔺添加这行代码 } repositories { google() jcenter() } dependencies { classpath("com.android.tools.build:gradle:4.1.0") classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // ❗🔺添加这行代码
// NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { mavenLocal() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") } maven { // Android JSC is installed from npm url("$rootDir/../node_modules/jsc-android/dist") } google() jcenter() maven { url 'https://www.jitpack.io' } } }
OK!焜耀了我击添的问题终于解决了,但我想你接下来会遇到诸如内存不足的问题!。。。。
» 下一篇: 2023-02-13 【Android studio内存不足】 Out of memory: Java heap space. Configure Gradle memory settings using '-Xmx' JVM option (e.g. '-Xmx2048m'.) Please fix the project's Gradle settings.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧