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

Flutter添加firebase_dynamic_links后出现:app:compileDebugKotlin任务执行失败

解决添加firebase_dynamic_links后的构建错误

你的构建配置里存在重复的依赖声明和版本冲突,这是导致错误的核心原因:

  • 重复声明了com.android.tools.build:gradle(同时指定了7.0.2和7.2.1两个版本)
  • 重复声明了kotlin-gradle-plugin(同时指定了1.5.31和1.7.10两个版本)

firebase_dynamic_links: ^5.4.8依赖的Kotlin版本与你配置里的旧版本存在兼容性问题,同时重复的版本声明会让Gradle无法确定使用哪个版本,进而引发构建失败。

修正后的buildscript配置

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

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

后续操作步骤

  • 保存修改后的配置文件
  • 执行flutter clean清理项目缓存
  • 运行flutter pub get重新拉取依赖
  • 重新构建项目

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.03 15:06:11