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

无法为Flutter项目集成Firebase,Gradle构建插件报错

解决Flutter集成Firebase时gradle插件找不到问题

报错信息

FAILURE: Build failed with an exception.
Where:
Settings file '/Users/daniilsereda/StudioProjects/translator/android/settings.gradle' line: 29

  • What went wrong:
    Plugin [id: 'com.google.gms.google-services', version: '4.4.1', apply: false] was not found in any of the following sources:
  • Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
  • Included Builds (None of the included builds contain this plugin)
  • Plugin Repositories (could not resolve plugin artifact 'com.google.gms.google-services:com.google.gms.google-services.gradle.plugin:4.4.1')
    Searched in the following repositories:
    Google
    MavenRepo
    Gradle Central Plugin Repository

解决步骤

  • 检查settings.gradle的pluginManagement仓库配置,确保google()仓库已正确添加且优先级合理:

    pluginManagement {
      repositories {
        google()
        gradlePluginPortal()
        mavenCentral()
      }
    }
    
  • 替换google-services插件版本为稳定兼容版,4.4.1可能存在同步异常,建议改用4.3.15:
    修改settings.gradle中对应行:

    id 'com.google.gms.google-services' version '4.3.15' apply false
    
  • 清理gradle缓存并强制刷新依赖:
    在项目根目录执行终端命令:

    cd android
    ./gradlew clean build --refresh-dependencies
    
  • 验证pubspec.yaml中Firebase依赖版本兼容性,确保使用最新稳定版的核心依赖:

    dependencies:
      firebase_core: ^2.24.2
    

内容的提问来源于stack exchange,提问作者white-mamba

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.25 20:42:38