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

Firebase谷歌认证异常:Android应用登录遇ApiException:10错误求助

Fixing Firebase Google Sign-In ApiException: 10 on Android

Hey there, I’ve wrestled with this exact com.google.android.gms.common.api.ApiException: 10: error more times than I can recall—it’s so frustrating when you’ve followed every step in the docs and still hit a wall! Let’s walk through the most common (and easy-to-miss) fixes that might resolve your issue:

  • Double-check all SHA1 (and SHA-256) fingerprints in Firebase
    Don’t just stop at your debug SHA1—if you’re testing a release build, or using a custom debug keystore, make sure all fingerprints for the builds you’re running are added to your Firebase project. You can grab the correct debug fingerprint with this command:

    keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
    

    For release builds, swap in your production keystore path, alias, and credentials. Also, add the SHA-256 fingerprint too—modern Google Sign-In requires it for some flows.

  • Validate OAuth 2.0 clients in Google Cloud Console
    Firebase syncs with Google Cloud under the hood, so head over to the Cloud Console linked to your Firebase project. Navigate to APIs & Services > Credentials and verify:

    • There’s an Android OAuth client ID with the exact SHA1 fingerprint you added to Firebase.
    • A Web OAuth client ID exists (yes, even for pure Android apps—some SDK dependencies rely on this).
  • Replace your google-services.json and rebuild
    Every time you update fingerprints or OAuth settings, you need to download a fresh google-services.json from Firebase and replace the one in your app’s root directory. After replacing, clean and rebuild your project:

    ./gradlew clean && ./gradlew assembleDebug
    

    This clears any cached config that might be stuck using old settings.

  • Confirm your package name is a perfect match
    Even a tiny typo in your package name (capitalization, extra character) between Firebase and your AndroidManifest.xml will break authentication. Double-check that the package name in Firebase’s app settings matches exactly what’s in your manifest’s package attribute.

  • Test on a fresh device/emulator
    Old cached Google account data or app preferences can mess with the sign-in flow. Try testing on a brand-new emulator, or clear your app’s data/storage on your test device before trying again.

  • Ensure the Google Sign-In API is enabled
    While Firebase usually enables this automatically, it’s worth confirming. In the Google Cloud Console’s APIs & Services > Library, search for "Google Sign-In API" and make sure it’s marked as enabled.

If you’ve tried all these and still see the error, check your Logcat for more detailed error messages—sometimes there’s a hint about a missing scope or misconfigured client that the generic ApiException:10 doesn’t reveal.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.20 08:07:44