我正在重建我的Android项目,这是在java和一些类是写在kotlin。我在谷歌搜索,但我的问题没有解决。我得到下面的错误,而建设我的项目:
/home/bansal/. gradle/缓存/转换-2/文件-2.1/0bea321a20a76ca878f594ef198fedcf/jetified-core-ktx-1.10.0-alpha02-api. jar !/元信息/内核-ktx_版本. kotlin_模块:模块是使用不兼容版本的Kotlin编译的。其元数据的二进制版本为1.8.0,应为1.6.0。
下面是我的建设. gradel
ext.kotlin_version = '1.6.10'
repositories {
google()
jcenter()
maven {
url 'http://dl.bintray.com/amulyakhare/maven'
}
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath 'io.realm:realm-gradle-plugin:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
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
}
和模块构建。gradle
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dependencies{
implementation 'androidx.core:core-ktx:1.7.0'
annotationProcessor 'android.arch.lifecycle:compiler:1.1.1'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'android.arch.lifecycle:viewmodel:1.1.1'
implementation 'android.arch.lifecycle:extensions:1.1.1'
//Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
implementation "androidx.core:core-ktx:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
2条答案
按热度按时间bqf10yzr1#
同样的问题,我得到了前几天..和解决这个问题太容易了
在您的build.gradle文件(您首先粘贴的文件)中,相同的类路径会被写入两次,因此请删除其中任何一次
从
在模块级build.gradle文件中,同一依赖关系会被提及两次
从
同步gradle并尝试运行到项目
nwo49xxi2#
我也遇到过类似的问题,但找到了不同的解决方案。Android Studio建议我从海豚更新到Electric Eel。我想事情不会变得更糟,于是我照做了,然后问题就消失了!