我有一个用react native编写的应用程序,我试图上传到google play商店,但是当我试图编译. aab文件时遇到了一些问题。
每当我尝试重新加载我的gradle项目时,我都会遇到356个错误,这些错误都与编译时使用的kotlin版本有关。
(This是错误消息:e: E: ... \App\node_modules\react-native-gradle-plugin\src\main\kotlin\com\facebook\react\utils\TaskUtils.kt: (24, 12): Class 'kotlin.collections.ArraysKt___ArraysKt' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
(x月1日至1x日)
我已经更改了我的build. gradle文件,以包含当前版本的gradle和kotlin,如下所示:
buildscript {
ext.kotlin_version = '1.8.0'
ext {
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
//kotlin_version = '1.8.0' //use latest
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"
}
}
//ext.kotlin_version = '1.7.21' //use latest
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:8.0.0-alpha11")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath("com.android.tools.build:gradle:8.0.0-alpha11")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:5.0.1")
//implementation "org.jetbrains.kotlin:kotlin-stdlib:1.8.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
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")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
}
}
任何帮助将不胜感激!
1条答案
按热度按时间wn9m85ua1#
1,扩展程序版本= '1.6.0'
2,在项目build.gradle中设置以下内容:
将“org.jetbrains.Kotlin:kotlin-gradle-plugin:$kotlin_version”版本更改为“org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0
3,在app build.gradle中设置以下内容:
检查“androidx.核心:核心-ktx:1.6.0”版本
因为属性“$Kotlin_version”已更新