最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

android - Flutter Firebase: Google-services.json File Not Found Despite Correct Placement - Stack Overflow

programmeradmin3浏览0评论

I am working on a Flutter app that integrates Firebase, but I keep running into the following error during the build process:

Execution failed for task ':processDebugGoogleServices'.
 File google-services.json is missing.
  The Google Services Plugin cannot function without it.
  Searched locations:
  C:\Users\Ryan\Documents\Child1st\Android 2.0\android2\android\src\debug\google-services.json
  C:\Users\Ryan\Documents\Child1st\Android 2.0\android2\android\src\google-services.json
  C:\Users\Ryan\Documents\Child1st\Android 2.0\android2\android\google-services.json

However, I have verified that the google-services.json file does exist in the correct location:

C:\Users\Ryan\Documents\Child1st\Android 2.0\android2\android\app\google-services.json

What I Have Tried:

Verified the Package Name The package name in google-services.json matches my project:

"android_client_info": {
  "package_name": "com.child1st.snapwordslista"
}

The same package name is set in:

  • AndroidManifest.xml
  • app/build.gradle.kts
  • google-services.json

Checked Gradle and Dependencies App-level build.gradle.kts includes Firebase dependencies:

plugins {
    id("com.android.application")
    id("kotlin-android")
    id("com.google.gms.google-services")
    id("dev.flutter.flutter-gradle-plugin") apply false
}

>dependencies {
    implementation(platform("com.google.firebase:firebase-bom:32.7.3"))
    implementation("com.google.firebase:firebase-analytics")
    implementation("com.google.firebase:firebase-firestore")
    implementation("com.google.firebase:firebase-storage")
}

Project-level build.gradle.kts includes required repositories:

>allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

Checked If Gradle Can See the File Running the following command in PowerShell:

Get-Content android/app/google-services.json

Output: It correctly prints the file contents.

Rebuilt the Project I tried running:

>cd android
./gradlew.bat clean
./gradlew.bat build --refresh-dependencies
cd ..
flutter clean
flutter pub get
flutter run

Still getting the missing google-services.json error.

Ensured Android Studio Syncs the File Restarted Android Studio, invalidated caches, and re-synced Gradle: File → Sync Project with Gradle Files Checked for any permission issues preventing Gradle from accessing the file.

Checked for Spaces in the File Path My project is stored in:

C:\Users\Ryan\Documents\Child1st\Android 2.0\android2\

Could the spaces in the directory name ("Android 2.0") be causing issues? I haven’t tested renaming the directory yet.

Question: Given all the troubleshooting steps I've tried, what else could be preventing Gradle from recognizing google-services.json?

Could this be a Gradle configuration issue? Is the project structure causing Gradle to look in the wrong directory? Any help would be greatly appreciated!

I am working on a Flutter app that integrates Firebase, but I keep running into the following error during the build process:

Execution failed for task ':processDebugGoogleServices'.
 File google-services.json is missing.
  The Google Services Plugin cannot function without it.
  Searched locations:
  C:\Users\Ryan\Documents\Child1st\Android 2.0\android2\android\src\debug\google-services.json
  C:\Users\Ryan\Documents\Child1st\Android 2.0\android2\android\src\google-services.json
  C:\Users\Ryan\Documents\Child1st\Android 2.0\android2\android\google-services.json

However, I have verified that the google-services.json file does exist in the correct location:

C:\Users\Ryan\Documents\Child1st\Android 2.0\android2\android\app\google-services.json

What I Have Tried:

Verified the Package Name The package name in google-services.json matches my project:

"android_client_info": {
  "package_name": "com.child1st.snapwordslista"
}

The same package name is set in:

  • AndroidManifest.xml
  • app/build.gradle.kts
  • google-services.json

Checked Gradle and Dependencies App-level build.gradle.kts includes Firebase dependencies:

plugins {
    id("com.android.application")
    id("kotlin-android")
    id("com.google.gms.google-services")
    id("dev.flutter.flutter-gradle-plugin") apply false
}

>dependencies {
    implementation(platform("com.google.firebase:firebase-bom:32.7.3"))
    implementation("com.google.firebase:firebase-analytics")
    implementation("com.google.firebase:firebase-firestore")
    implementation("com.google.firebase:firebase-storage")
}

Project-level build.gradle.kts includes required repositories:

>allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

Checked If Gradle Can See the File Running the following command in PowerShell:

Get-Content android/app/google-services.json

Output: It correctly prints the file contents.

Rebuilt the Project I tried running:

>cd android
./gradlew.bat clean
./gradlew.bat build --refresh-dependencies
cd ..
flutter clean
flutter pub get
flutter run

Still getting the missing google-services.json error.

Ensured Android Studio Syncs the File Restarted Android Studio, invalidated caches, and re-synced Gradle: File → Sync Project with Gradle Files Checked for any permission issues preventing Gradle from accessing the file.

Checked for Spaces in the File Path My project is stored in:

C:\Users\Ryan\Documents\Child1st\Android 2.0\android2\

Could the spaces in the directory name ("Android 2.0") be causing issues? I haven’t tested renaming the directory yet.

Question: Given all the troubleshooting steps I've tried, what else could be preventing Gradle from recognizing google-services.json?

Could this be a Gradle configuration issue? Is the project structure causing Gradle to look in the wrong directory? Any help would be greatly appreciated!

Share Improve this question asked 11 hours ago Ryan The GreatRyan The Great 498 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You need to check that the firebase.json file at the root of your project contains the path to the google-services.json file.

"android": {
  "default": {
    "projectId": "XXXXX",
    "appId": "XXXXX",
    "fileOutput": "android/app/google-services.json"
  }
}
发布评论

评论列表(0)

  1. 暂无评论