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

如何解决Android项目构建报错:Could not find com.google.gms.google-services:4.3.15

解决构建错误:Could not find com.google.gms.google-services:4.3.15

错误详情

FAILURE: 构建因异常失败。

  • 出错原因:
    配置根项目“android”时出现问题。
    无法解析配置':classpath'的所有文件。
    Could not find com.google.gms.google-services:4.3.15。
    依赖需求方:
    项目 :

解决步骤

  • 添加Google Maven仓库
    打开根目录下的build.gradle文件,确保buildscript块中包含google()仓库(这是Google官方依赖的唯一合法仓库源):

    buildscript {
        repositories {
            google()
            mavenCentral()
        }
        dependencies {
            classpath 'com.google.gms:google-services:4.3.15'
        }
    }
    

    若之前使用的是maven { url 'https://maven.google.com' },替换为google()即可,两者等效但后者是Android Studio推荐写法。

  • 校验依赖版本
    若4.3.15版本已被移除或输入错误,可替换为当前稳定版本,比如:

    classpath 'com.google.gms:google-services:4.4.0'
    
  • 清理缓存并同步项目

    1. 点击Android Studio右上角的「Sync Project with Gradle Files」按钮同步项目
    2. 执行File -> Invalidate Caches... -> Invalidate and Restart清理IDE缓存并重启

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.18 07:35:04