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

Flutter集成Firebase构建报错:无法解析com.google.gms.google-services:4.4.0

Flutter + Firebase 构建失败:Could not find com.google.gms.google-services:4.4.0: 问题解决

问题原因

你在项目根目录的build.gradle文件中,错误填写了Google Services Gradle插件的依赖坐标——正确的groupId是com.google.gms,但你写成了com.google.gms.google-services,导致Gradle无法在配置的仓库中找到对应依赖包,最终触发构建失败。

详细修复步骤

  1. 修正根目录build.gradle的依赖配置
    打开项目根目录下的build.gradle文件,找到dependencies块中的这一行:

    classpath 'com.google.gms.google-services:4.4.0'
    

    将其替换为正确的依赖坐标:

    classpath 'com.google.gms:google-services:4.4.0'
    
  2. 清理缓存并重新构建
    执行以下命令彻底清理项目缓存并重新构建:

    flutter clean
    flutter pub get
    cd android && ./gradlew clean
    cd .. && flutter run
    

    如果你使用Android Studio,也可以点击顶部菜单栏的File -> Invalidate Caches...,选择Invalidate and Restart重启IDE并清理缓存,之后再重新运行项目。

额外检查(确保配置无遗漏)

  • 确认项目根目录build.gradle的repositories块中已经包含google()和mavenCentral()(你的配置已满足此要求);
  • 确认app模块的build.gradle中已正确应用com.google.gms.google-services插件(你的配置已正确添加)。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.05 06:25:00