“java.com.google.android.gmscore.integ.client.measurement_api_measurement_api.kotlin_module” 此错误发生在 Firebase 更新工件后

"java.com.google.android.gmscore.integ.client.measurement_api_measurement_api.kotlin_module" this error happens after firebase updated there artifacts

提问人:LEGARA Carlo C 提问时间:11/10/2023 更新时间:11/10/2023 访问量:111

问:

e: C:/Users/USER-DIRECTORY/.gradle/caches/transforms-3/d0733e98db50bf72d2f0482087ca7918/transformed/jetified-play-services-measurement-api-21.5.0-api.jar!/META-INF/java.com.google.android.gmscore.integ.client.measurement_api_measurement_api.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.     

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileReleaseKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* 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 4m 37s
Running Gradle task 'assembleRelease'...                          278.1s

所以,这是我现在在我的 Flutter 项目中面临的错误。在 Google 和 Firebase 于 2023 年 10 月 30 日更新了他们的工件之后。Google 这里和 Firebase 这里

这是我的build.gradle

buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.4.0'
    }
}

对于我的 app/build.gradle

android {
    namespace 'com.example.namespace'
    compileSdkVersion 34
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.parkbai.com"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
        minSdkVersion 22
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation platform('com.google.firebase:firebase-bom:32.5.0')
    implementation 'com.google.firebase:firebase-analytics'
}

apply plugin: 'com.google.gms.google-services'

我不知道这里有什么问题,我已经搜索了其他网站来帮助我,但这些网站都没有帮助我的情况。

我想为我的 Android Flutter 应用程序构建一个 apk,然后就可以运行了。

颤振 Firebase 飞镖 google-play-services

评论


答:

0赞 jefe23984 11/25/2023 #1

嵌。ext.kotlin_version = '1.9.10'android/build.gradle

更多细节可以在这里找到