【问题标题】:Getting kotlin dependency issue in buildSrc when used with Firestore与 Firestore 一起使用时在 buildSrc 中出现 kotlin 依赖问题
【发布时间】:2022-11-29 15:31:54
【问题描述】:

我正在使用 kotlin 1.7.20 如下

classpath ("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")

当我从普通的 build.gradle 访问以下 firebase 代码时,它会被编译。但是当从 buildSrc 内部使用时,我收到错误消息,因为预期是 kotlin 1.5.1 模块,但发现是 1.7.1

plugins {
    `kotlin-dsl`
}

repositories {
    google()
    mavenCentral()
}

dependencies {
    // firebase
    implementation (platform("com.google.firebase:firebase-bom:31.0.2"))
    implementation ("com.google.firebase:firebase-firestore-ktx")
}

错误如下

/Users/xx/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.10/0d0a9e3f3673ba/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.

我的主要要求是在通过自定义任务进行 gradle 同步的情况下触发 firebase。

我尝试更改值,但没有用

【问题讨论】:

    标签: android google-cloud-firestore gradle-kotlin-dsl buildsrc


    【解决方案1】:

    这是由于版本不匹配问题而发生的。我建议您将 kotlin 版本更新到最新版本。对于这种情况,我提供了您的系统所需的版本,需要从 build.gradle 更改此行

    ext.kotlin_version = '1.5.1'
    

    ext.kotlin_version = '1.7.1'
    ``
    

    【讨论】:

      猜你喜欢
      • 2019-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-16
      • 2015-09-15
      • 1970-01-01
      • 2019-06-26
      • 2021-12-08
      相关资源
      最近更新 更多