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

Flutter应用上架Play Store后Firebase登录相关崩溃问题求助

Fixing Firebase Auth Crash in Flutter App on Google Play Store

Hey there, let's tackle this crash issue you're hitting with your Flutter app post-deployment to Google Play Store. The crash happens in SignInHubActivity with a NullPointerException when calling String.equals() on a null reference—this usually ties back to misconfigured Google Services or Firebase Auth setup, especially since the app works locally but breaks on Play Store.

First, let's recap the crash log for clarity:

com.google.android.gms.auth.api.signin.internal.SignInHubActivity}: java.lang.NullPointerException: Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.RandstadRecruiter/com.google.android.gms.auth.api.signin.internal.SignInHubActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference at android.app.ActivityThread.performLaunchActivity + 2665(ActivityThread.java:2665) at android.app.ActivityThread.handleLaunchActivity + 2726(ActivityThread.java:2726) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage + 1477(ActivityThread.java:1477) at android.os.Handler.dispatchMessage + 102(Handler.java:102) at android.os.Looper.loop + 154(Looper.java:154) at android.app.ActivityThread.main + 6119(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run + 886(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main + 776(ZygoteInit.java:776) at de.robv.android.xposed.XposedBridge.main + 107(XposedBridge.java:107)

Here are the most likely fixes to resolve this:

  • Upgrade Google Services Plugin Version
    You're using classpath 'com.google.gms:google-services:4.2.0' which is quite outdated. Old versions often have compatibility issues with newer Firebase SDKs and Play Store's signing infrastructure. Update this in your project-level build.gradle to the latest stable version (e.g., classpath 'com.google.gms:google-services:4.3.15'—check for the latest stable release if needed).

  • Sync Firebase Auth Plugin to Latest Stable Version
    Outdated firebase_auth packages can clash with newer Google Services. Open your pubspec.yaml, update the dependency to the latest stable release (e.g., firebase_auth: ^4.10.0), then run flutter pub get to fetch the latest version.

  • Add Play Store Signing SHA-1 to Firebase Console
    When you upload your app to Play Store, Google re-signs it with their own certificate. If you only added your local debug/release SHA-1 to Firebase, this will cause authentication failures. Here's how to fix it:

    1. Go to your Google Play Console, select your app → App signing under "Release".
    2. Copy the SHA-1 fingerprint from the "App signing certificate" section.
    3. Head to your Firebase Console, open your project → Project Settings → select your existing Android app.
    4. Paste the copied SHA-1 into the corresponding field, save changes, and download the updated google-services.json.
    5. Replace the google-services.json in your Flutter project's android/app directory with this new file.
  • Verify google-services.json Configuration
    Double-check that the google-services.json file in your project has the correct package name (com.RandstadRecruiter as seen in the crash log) and matches the Firebase project you're using. A mismatch here can lead to unexpected null references during auth flows.

  • Clean and Rebuild Your Project
    Cached build artifacts can sometimes cause configuration issues. Run flutter clean to clear old builds, then rebuild your app with flutter build appbundle (for Play Store) or flutter build apk, and re-upload the new build to Play Store.

After applying these steps, the crash should be resolved as the auth flow will have all the correct configuration to work with Play Store's signed app.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.14 07:44:49