在模块jefied-kotlin-stdlib-1.8.0中找到的重复类kotlin. interal.jdk7.JDK7Platformations(org.jetBrains.kotlin:kotlin-stdlib:1.8.0)和jefied-kotlin-stdlib-jdk7-1.3.31(org.jetBrains.kotlin:kotlin-stdlib-jdk7:1.3.31)
kotlin. jdk7.AutoCloseableKt在模块jefied-kotlin-stdlib-1.8.0(org.jetcings.kotlin:kotlin-stdlib:1.8.0)和jefied-kotlin-stdlib-jdk7-1.3.31(org.jetclin.kotlin:kotlin-stdlib-jdk7:1.3.31)中找到
**./gradlew干净**
build. gradle文件:
buildscript {
ext {
buildToolsVersion = "30.0.0"
minSdkVersion = 23
compileSdkVersion = 33
targetSdkVersion = 30
googlePlayServicesAuthVersion = "16.0.1"
kotlinVersion = "1.8.0"
}
firebase: [
bom : "26.0.0"
]
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.0"
classpath "com.google.gms:google-services:4.3.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
allprojects {
repositories {
configurations.all {
resolutionStrategy {
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
}
}
mavenLocal()
maven {
url("$rootDir/../node_modules/react-native/android")
}
maven {
url("$rootDir/../node_modules/jsc-android/dist")
}
maven { url 'https://maven.google.com' }
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
我的应用程序也有同样的问题。它无法构建,因为在模块jefied-kotlin-stdlib-1.8.0
和jefied-kotlin-stdlib-jdk8-1.6.10
中发现了重复的类
Igor VANIAN分享的链接:https://kotlinlang.org/docs/whatsnew18.html#usage-of-the-latest-kotlin-stdlib-version-in-transitive-dependencies我补充道
dependencies {
...
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
}
到我的android/app/build. gradle
和Android构建现在很好
我开始在android端的react native中遇到同样的问题。我将静态编程语言升级到1.8.0版,并再次构建应用程序,问题得到了修复。也许尝试升级kotlin版本。
在android/build. gradle中更新以下内容
kotlinVersion="1.8.0"
并将其添加到依赖项下
classpath"org. jetcons.kotlin:kotlin-gradle-plugin:$kotlinVersion"
谢谢大家,我通过做两件事来解决它
在android/build. gradle中更新以下内容
kotlinVersion="1.8.0"
在android/app/build. gradle中,在依赖项中添加以下内容
实现(平台("org. jet大脑.kotli n:kotli n-bom:1.8.0"))