Unity + Firebase + Google Sign-In Integration Notes
Environment used while writing these notes:
- Unity 2021.3.33f1
- JDK 1.8
- Gradle 6.1.1
- Firebase SDK 9.6.0
- Google Sign-In 1.0.1
Issue 1: App crashes when tapping “Sign in”
After converting the APK to ZIP and inspecting the extracted libraries, I noticed that /lib/armeabi-v7a contained libnative-googlesignin.so, but /lib/arm64-v8a did not. On arm64 devices the loader therefore reported “native-googlesignin.so not found”.
Unpacking GoogleSignIn/Editor/mm2repository/com/google/signin/google-signin-support/1.0.1/google-signin-support-1.0.1.aar confirmed that the arm64 binary was indeed missing. The workaround is to rebuild the package and add the missing ABI in build.gradle (screenshot referenced in the Chinese article).
Issue 2: Linking Firebase Authentication with Google Sign-In
In the Firebase console open Authentication → Sign-in method and enable Google as a provider. Make sure the SHA-1/ SHA-256 fingerprints are configured so Firebase trusts the Android build.
Issue 3: Error SignInFragment Exception caught! Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;
This stack trace usually indicates mismatched Play Services / Firebase versions. Update the Gradle dependencies so that the Google Sign-In plugin and Firebase libraries are aligned. Example working block:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Android Resolver Dependencies Start
implementation 'com.google.android.gms:play-services-auth:10+' // Assets/GoogleSignIn/Editor/GoogleSignInDependencies.xml:20
implementation 'com.google.android.gms:play-services-base:18.1.0' // Assets/Firebase/Editor/AppDependencies.xml:17
implementation 'com.google.firebase:firebase-analytics:21.1.1' // Assets/Firebase/Editor/FirestoreDependencies.xml:15
implementation 'com.google.firebase:firebase-analytics-unity:9.6.0' // Assets/Firebase/Editor/AnalyticsDependencies.xml:18
implementation 'com.google.firebase:firebase-app-unity:9.6.0' // Assets/Firebase/Editor/AppDependencies.xml:22
implementation 'com.google.firebase:firebase-auth:21.0.8' // Assets/Firebase/Editor/AuthDependencies.xml:13
implementation 'com.google.firebase:firebase-auth-unity:9.6.0' // Assets/Firebase/Editor/AuthDependencies.xml:20
implementation 'com.google.firebase:firebase-common:20.1.2' // Assets/Firebase/Editor/AppDependencies.xml:13
implementation 'com.google.firebase:firebase-crashlytics-ndk:18.2.13' // Assets/Firebase/Editor/CrashlyticsDependencies.xml:13
implementation 'com.google.firebase:firebase-crashlytics-unity:9.6.0' // Assets/Firebase/Editor/CrashlyticsDependencies.xml:20
implementation 'com.google.firebase:firebase-firestore:24.3.1' // Assets/Firebase/Editor/FirestoreDependencies.xml:13
implementation 'com.google.firebase:firebase-firestore-unity:9.6.0' // Assets/Firebase/Editor/FirestoreDependencies.xml:20
implementation 'com.google.signin:google-signin-support:1+' // Assets/GoogleSignIn/Editor/GoogleSignInDependencies.xml:11
// Android Resolver Dependencies End
}
Issue 4: Attempt to load writable dex file
Ensure that both the Firebase packages and the Google Sign-In plugin are checked for the Android platform inside the Unity Plugin Inspector. Missing platform toggles often leave behind stale resolver output and cause this dex warning.
Feel free to leave a comment if you run into other edge cases—while the setup steps are still fresh in memory I’m happy to help.