Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.

报错信息如下:

> Task :app:lintVitalAnalyzeRelease
e:D:/work/repository/sample/app/build/.transforms/aa3e5b20bbf5695729bf34a4f5d4a0c7/transformed/out/jars/classes.jar!/META-INF/uploadlog_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.7.10/d70d7d2c56371f7aa18f32e984e3e2e998fe9081/kotlin-stdlib-jdk8-1.7.10.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/transforms-3/30d98ba24e9c4d46ffaa39af5f5ad345/transformed/jetified-common-2023.09.28-SNAPSHOT/jars/classes.jar!/META-INF/common_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/transforms-3/0d04137317a24900a05c1f52b4eed2b5/transformed/jetified-component-2023.09.28-SNAPSHOT/jars/classes.jar!/META-INF/component_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/transforms-3/6c3936634e94d9626acaf5a52253ec68/transformed/jetified-dialog-2023.09.28-SNAPSHOT/jars/classes.jar!/META-INF/dialog_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/transforms-3/28d65e7fec310e78c883929aecba7885/transformed/jetified-lottie-2023.09.28-SNAPSHOT/jars/classes.jar!/META-INF/lottie_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.7.10/1ef73fee66f45d52c67e2aca12fd945dbe0659bf/kotlin-stdlib-jdk7-1.7.10.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.10/d2abf9e77736acc4450dc4a3f707fa2c10f5099d/kotlin-stdlib-1.7.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.10/bac80c520d0a9e3f3673bc2658c6ed02ef45a76a/kotlin-stdlib-common-1.7.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.

 

> Task :app:lintVitalAnalyzeRelease
e:D:/work/repository/sample/app/build/.transforms/aa3e5b20bbf5695729bf34a4f5d4a0c7/transformed/out/jars/classes.jar!/META-INF/uploadlog_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.7.10/d70d7d2c56371f7aa18f32e984e3e2e998fe9081/kotlin-stdlib-jdk8-1.7.10.jar!/META-INF/kotlin-stdlib-jdk8.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/transforms-3/30d98ba24e9c4d46ffaa39af5f5ad345/transformed/jetified-common-2023.09.28-SNAPSHOT/jars/classes.jar!/META-INF/common_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/transforms-3/0d04137317a24900a05c1f52b4eed2b5/transformed/jetified-component-2023.09.28-SNAPSHOT/jars/classes.jar!/META-INF/component_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/transforms-3/6c3936634e94d9626acaf5a52253ec68/transformed/jetified-dialog-2023.09.28-SNAPSHOT/jars/classes.jar!/META-INF/dialog_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/transforms-3/28d65e7fec310e78c883929aecba7885/transformed/jetified-lottie-2023.09.28-SNAPSHOT/jars/classes.jar!/META-INF/lottie_release.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.7.10/1ef73fee66f45d52c67e2aca12fd945dbe0659bf/kotlin-stdlib-jdk7-1.7.10.jar!/META-INF/kotlin-stdlib-jdk7.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.10/d2abf9e77736acc4450dc4a3f707fa2c10f5099d/kotlin-stdlib-1.7.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.
e: C:/Users/user/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.10/bac80c520d0a9e3f3673bc2658c6ed02ef45a76a/kotlin-stdlib-common-1.7.10.jar!/META-INF/kotlin-stdlib-common.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.7.1, expected version is 1.5.1.

解决方法如下:

项目根build.gradle:

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"

buildscript {
    repositories {...}
    dependencies {
        classpath "com.android.tools.build:gradle:7.1.3"
        //classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
    }
}

 resolutionStrategy {
            force 'org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10'
 }

allprojects {
    repositories {...}

    configurations.all {
        resolutionStrategy {
            force 'org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10'
        }
    }
}

项目module中的build.gradle

如app下的build.gradle

targetSdkVersion 30

resolutionStrategy.force 'org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10'

configurations.all {
    //每隔24小时检查远程依赖是否存在更新
//    resolutionStrategy.cacheChangingModulesFor 24, 'hours'
    //每隔10分钟..
    //resolutionStrategy.cacheChangingModulesFor 10, 'minutes'
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
    // 采用动态版本声明的依赖缓存10分钟
    resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'

    resolutionStrategy.force 'org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10'
}

dependencies {
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'androidx.appcompat:appcompat:1.6.0-alpha01'
}

在此做个笔记

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值