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

Gradle构建失败求助:缺失google-services.json文件

Fix for "File google-services.json is missing" with nullnull in search paths

Hey there, let's work through this frustrating issue you're hitting with the Google Services plugin. The key red flag here is those nullnull entries in the search paths—this tells us there's a problem with how your build configuration is being parsed, leading the plugin to look in invalid locations for the google-services.json file.

First, let's recap what you've already tried (great troubleshooting steps, by the way!):

  • Removing ad-related code didn't resolve the issue
  • Removing apply plugin: 'com.google.gms.google-services' lets the project run normally, confirming the problem is tied directly to this plugin

Here are targeted fixes to try:

1. Verify google-services.json placement

Double-check that your google-services.json file is placed directly in the root of your app module (the last path listed in the error: C:\Users\Mrwan\Desktop\QassWaNwadar\app\google-services.json). If it's in any subfolder (like src/debug), move it to the app root—this is the default location the plugin checks first, and avoids issues with build variant path parsing.

2. Check for invalid build variant/flavor configurations

The nullnull in the search paths suggests that Gradle is trying to combine a build type (like debug) with an empty or undefined product flavor. Even though your posted build.gradle doesn't show product flavors, there might be residual configuration in:

  • The project-level build.gradle file
  • A forgotten flavorDimensions or productFlavors block that was partially removed
  • Cached build data that's holding onto old configuration

To fix this:

  • Open your project-level build.gradle and ensure there's no leftover flavor-related code
  • Go to File > Invalidate Caches... > Invalidate and Restart to clear any cached build data

3. Align Google Services plugin version with Play Services dependencies

Your build.gradle uses com.google.android.gms:play-services-ads:15.0.1, but you need to make sure the Google Services plugin version in your project-level build.gradle is compatible. For Play Services 15.x, use at least version 3.2.1 of the plugin:

// In project-level build.gradle
buildscript {
    dependencies {
        classpath 'com.google.gms:google-services:3.2.1' // Match this to your Play Services version
    }
}

Mismatched versions can cause unexpected path-parsing issues like the one you're seeing.

4. Clean and rebuild the project

Sometimes cached build artifacts can cause weird glitches. Run these steps:

  • Execute Build > Clean Project in Android Studio
  • Then run Build > Rebuild Project
  • Alternatively, run this command in your project root terminal (Windows):
    gradlew clean build
    

Your error details for reference:

FAILURE: Build failed with an exception.

  • 出错原因:任务':app:processDebugGoogleServices'执行失败。
    提示:File google-services.json is missing. The Google Services Plugin cannot function without it. 搜索路径如下:
    C:\Users\Mrwan\Desktop\QassWaNwadar\app\src\nullnull\debug\google-services.json
    C:\Users\Mrwan\Desktop\QassWaNwadar\app\src\debug\nullnull\google-services.json
    C:\Users\Mrwan\Desktop\QassWaNwadar\app\src\nullnull\google-services.json
    C:\Users\Mrwan\Desktop\QassWaNwadar\app\src\debug\google-services.json
    C:\Users\Mrwan\Desktop\QassWaNwadar\app\src\nullnullDebug\google-services.json
    C:\Users\Mrwan\Desktop\QassWaNwadar\app\google-services.json
  • 建议:使用--stacktrace选项获取堆栈跟踪,使用--info或--debug选项获取更多日志输出,使用--scan获取完整分析信息。
  • 更多帮助:https://help.gradle.org
    BUILD FAILED in 6s

Your app module Gradle config:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.date.brian.cradletest"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'
    implementation 'com.getbase:floatingactionbutton:1.9.0'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.google.android.gms:play-services-ads:15.0.1'
    testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

内容的提问来源于stack exchange,提问作者Mrwan Yassin ALGANAD

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 06:34:01