You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

连接Firebase后Kotlin库版本兼容问题求助

解决Kotlin库编译版本不兼容问题

步骤1:升级项目Kotlin版本到兼容最高版

你的Android Studio Bumblebee(搭配AGP 7.1.2)支持的最高稳定版Kotlin为1.7.20,修改项目级build.gradle中的Kotlin插件版本:

plugins {
    id 'com.android.application' version '7.1.2' apply false
    id 'com.android.library' version '7.1.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.20' apply false // 更新此处版本号
}

步骤2:调整依赖版本适配当前环境

部分依赖(如Material组件、Firebase Auth)使用了更高版本的Kotlin编译器编译,需降级到与当前环境兼容的版本,修改模块级build.gradle的依赖块:

dependencies {
    implementation 'androidx.core:core-ktx:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.6.1' // 降级Material版本
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'com.google.firebase:firebase-auth-ktx:21.0.1' // 降级Firebase Auth版本
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

步骤3:清理并重建项目

  1. 点击Android Studio顶部菜单栏的Build -> Clean Project
  2. 完成后点击Build -> Rebuild Project
  3. 等待Gradle同步完成,错误即可消除

内容的提问来源于stack exchange,提问作者Anshika Choudhary

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 20:12:48