简体   繁体   English

尝试将项目连接到 firebase 时 kotlin 的不兼容版本

[英]incompatibile version of kotlin when trying to connect project to firebase

The failure is: 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.失败是:模块是使用不兼容版本 Kotlin 编译的。其元数据的二进制版本为 1.7.1,预期版本为 1.5.1。

top leve gradle顶层 gradle

buildscript {
    ext {
        compose_version = '1.0.1'
    }

    repositories {
        google()
        mavenCentral()
    }
    dependencies{
        classpath "com.android.tools.build:gradle:7.0.4"
        classpath 'com.google.gms:google-services:4.3.14'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.1"
    }
}
plugins {
    id 'com.android.application' version '7.1.3' apply false
    id 'com.android.library' version '7.1.3' apply false
    id 'org.jetbrains.kotlin.android' version '1.5.21' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

gradle module gradle模块

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'com.google.gms.google-services'
}

android {
    compileSdk 32

    defaultConfig {
        applicationId "com.example.loginform"
        minSdk 21
        targetSdk 32
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        compose true
    }
    composeOptions {
        kotlinCompilerExtensionVersion compose_version
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
}

dependencies {
    implementation platform('com.google.firebase:firebase-bom:31.0.3')
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation "androidx.compose.material:material-icons-extended:$compose_version"
    implementation 'androidx.core:core-ktx:1.7.0'
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation "androidx.compose.material:material:$compose_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
    implementation 'androidx.activity:activity-compose:1.3.1'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
}

can anyone help me?谁能帮我? Remember that this is a compose application I seem to follow every tutorial how to join my app to firebase but gradle doesn't work.请记住,这是一个组合应用程序,我似乎遵循每个教程如何将我的应用程序加入 firebase,但 gradle 不起作用。

If I change org.jetbrains.kotlin.android version '1.5.21' to '1.5.1' it throws another failure: org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.jetbrains.kotlin.android', version: '1.5.1', apply: false] was not found in any of the following sources如果我将 org.jetbrains.kotlin.android 版本 '1.5.21' 更改为 '1.5.1' 它会引发另一个失败: org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.jetbrains.881903282. 1.5.1', apply: false] 未在以下任何来源中找到

In project gradle: add:在项目 gradle 中:添加:

buildscript {
    ext {
        kotlin_version = "1.7.20"
        ...
        ...

and change:并改变:

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.1"
to classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:kotlin_version"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试将 Firebase 依赖项添加到 Qt 项目时生成错误 - Build error when trying to add Firebase dependency to Qt project 将 firebase 连接到节点项目时,它显示 db 未定义 - When connect firebase to node project it show db is not defined 如何将 Firebase 连接到 Node.JS 项目? - How to connect Firebase to a Node.JS project? 将 Firebase 应用到 Android Studio 项目版本 Bumblebee - Apply Firebase to Android Studio Project version Bumblebee 当我按照文档尝试将我的 Android Studio 连接到 Firebase 时出现错误 - Getting error when I am trying to connect my Android Studio to Firebase following the docs 当我将 firebase 与节点 js 连接时。 我得到了这个错误。 我如何修复此错误并将 firebase 连接到 node express 项目 - when I connecting firebase with node js. I got this error. how I fix this error and connect firebase to node express project 无法在Flutter项目的Android模拟器中连接Firebase - Unable to connect Firebase in Android Emulator for Flutter Project 无法连接本地 Firebase 模拟器套件托管与 Firestore(Web 版本 9) - Unable to connect local Firebase emulator suite Hosting with Firestore (Web version 9) Firebase 身份验证问题,Kotlin - Firebase authentication issues, Kotlin Kotlin 协程与 firebase 函数 - Kotlin coroutine with firebase functions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM