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

Android Studio同步项目遇Missing Google App Id报错(已含google-services.json)求助

Fixing "Missing Google App Id" Error When Syncing Android Project (With google-services.json Already Present)

Hey there, let’s work through this frustrating sync error together. Even though you’ve got the google-services.json file in your app directory, there are a few common issues that might be triggering the "Missing Google App Id" message. Here’s what to check:

1. Double-Check the google-services.json File

  • Location: Ensure the file is directly in the app module’s root directory (not the project root, or subfolders like src/main). If you use product flavors, place the corresponding config file in the flavor-specific folder (e.g., app/src/dev for a "dev" flavor).
  • Validity: Open the file and look for the mobilesdk_app_id field—it should have a value formatted like 1:1234567890:android:abcdef1234567890. If this field is missing or empty, you likely downloaded the wrong config file from Firebase.
  • Variant Match: If you have multiple build variants (debug/release or custom flavors), confirm you’re using the correct google-services.json for the variant you’re syncing. Re-download the config from Firebase specifically for that variant if needed.

2. Verify Gradle Configuration

  • Project-Level Build.gradle: Make sure you’ve added the Google Services classpath in the dependencies block of your project’s root build.gradle file:
    dependencies {
        classpath 'com.google.gms:google-services:4.4.0' // Use the latest stable version
        // Other classpath dependencies...
    }
    
  • App-Level Build.gradle: Confirm the Google Services plugin is applied. For older Gradle versions, add this at the bottom of the file:
    apply plugin: 'com.google.gms.google-services'
    
    For Android Gradle Plugin 7.0+, add it to the plugins block instead:
    plugins {
        id 'com.android.application'
        id 'com.google.gms.google-services' // Add this line
    }
    

3. Clean, Rebuild, and Resync

  • Run Build > Clean Project from the Android Studio menu, followed by Build > Rebuild Project.
  • If that doesn’t work, manually delete the .gradle and .build folders (both in the project root and app module), restart Android Studio, then sync your project again. This clears cached configuration that might be causing conflicts.

4. Confirm Firebase Project Association

  • Check that your app’s package name exactly matches the one registered in your Firebase project (case-sensitive, though package names are typically lowercase).
  • Ensure the app is still listed in your Firebase project—accidental removal would invalidate the config file.

If you work through these steps, one of them will almost certainly fix the sync error. Let me know if you hit any snags along the way!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 09:45:42