我刚刚在android/build.gradle中更新了Kotlin版本
buildscript {
ext.kotlin_version = '1.7.21' // originally ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
做完这些之后,我试着运行我的Flutter项目,结果失败了,出现了这个异常。
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDevelopmentDebugDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.0-Beta (org.jetbrains.kotlin:kotlin-stdlib:1.8.0-Beta) and jetified-kotlin-stdlib-jdk8-1.5.31 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31)
Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations found in modules jetified-kotlin-stdlib-1.8.0-Beta (org.jetbrains.kotlin:kotlin-stdlib:1.8.0-Beta) and jetified-kotlin-stdlib-jdk8-1.5.31 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31)
Duplicate class kotlin.random.jdk8.PlatformThreadLocalRandom found in modules jetified-kotlin-stdlib-1.8.0-Beta (org.jetbrains.kotlin:kotlin-stdlib:1.8.0-Beta) and jetified-kotlin-stdlib-jdk8-1.5.31 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31)
Duplicate class kotlin.streams.jdk8.StreamsKt found in modules jetified-kotlin-stdlib-1.8.0-Beta (org.jetbrains.kotlin:kotlin-stdlib:1.8.0-Beta) and jetified-kotlin-stdlib-jdk8-1.5.31 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$1 found in modules jetified-kotlin-stdlib-1.8.0-Beta (org.jetbrains.kotlin:kotlin-stdlib:1.8.0-Beta) and jetified-kotlin-stdlib-jdk8-1.5.31 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$2 found in modules jetified-kotlin-stdlib-1.8.0-Beta (org.jetbrains.kotlin:kotlin-stdlib:1.8.0-Beta) and jetified-kotlin-stdlib-jdk8-1.5.31 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$3 found in modules jetified-kotlin-stdlib-1.8.0-Beta (org.jetbrains.kotlin:kotlin-stdlib:1.8.0-Beta) and jetified-kotlin-stdlib-jdk8-1.5.31 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31)
Duplicate class kotlin.streams.jdk8.StreamsKt$asSequence$$inlined$Sequence$4 found in modules jetified-kotlin-stdlib-1.8.0-Beta (org.jetbrains.kotlin:kotlin-stdlib:1.8.0-Beta) and jetified-kotlin-stdlib-jdk8-1.5.31 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31)
Duplicate class kotlin.text.jdk8.RegexExtensionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.0-Beta (org.jetbrains.kotlin:kotlin-stdlib:1.8.0-Beta) and jetified-kotlin-stdlib-jdk8-1.5.31 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31)
Duplicate class kotlin.time.jdk8.DurationConversionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.0-Beta (org.jetbrains.kotlin:kotlin-stdlib:1.8.0-Beta) and jetified-kotlin-stdlib-jdk8-1.5.31 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31)
Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)
* 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.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 53s
Exception: Gradle task assembleDevelopmentDebug failed with exit code 1
"我尝试过的事"
我试着扑干净和运行酒吧得到;然后再次运行该项目。发生了相同的异常。
我已经尝试删除.gradle文件夹内的android文件夹后,做上述过程。
我还创建了一个新项目来检查我安装的库(Android SDK、Flutter SDK等)是否有问题,它运行时没有任何错误,所以没有问题。
有人能帮忙吗。
1条答案
按热度按时间z9smfwbn1#
更改Kotlin版本