问题描述
我现在下载了share_plus包后发现代码编译不通过,并提示Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules jetified-kotlin-stdlib-1.8.22 (org.jetbrains.kotlin:kotlin-stdlib:1.8.22) and jetified-kotlin-stdlib-jdk8-1.7.10 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10)
解决办法
这个问题是由kotlin版本差异造成的,以下是解决办法
修改 android/settings.gradle
文件
将下面的代码
plugins {id "dev.flutter.flutter-plugin-loader" version "1.0.0"id "com.android.application" version "7.3.0" apply falseid "org.jetbrains.kotlin.android" version "1.7.10" apply false // <-----this row
}
改变成
plugins {id "dev.flutter.flutter-plugin-loader" version "1.0.0"id "com.android.application" version "7.3.0" apply falseid "org.jetbrains.kotlin.android" version "1.8.0" apply false // <-----this row
}