I have a project using firebase and the firebase auth ui library. The problem is I can't sign in using Google sign-in, when I try it loads for a second or two and then just shows a toast message saying "Developer Error". I can sign in with email and password just fine. And this is only a problem on signed apks, when I am debugging Google, sign-in works fine.
In my proguard-rules.pro I have minifyEnabled set to false.
And I have added the SHA-1 to my firebase project and have downloaded the correct json file.
dependency block from app level build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.android.support:cardview-v7:26.0.2'
compile 'com.google.firebase:firebase-database:11.4.2'
compile 'com.google.firebase:firebase-auth:11.4.2'
compile 'com.firebaseui:firebase-ui-auth:3.1.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
here is my AuthStateListener
mAuthStateListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null) {
signedInInitialized();
} else {
signedOutCleanUp();
startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setTheme(R.style.FirebaseSignInTheme)
.setIsSmartLockEnabled(false)
.setAvailableProviders(
Arrays.asList(new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build(),
new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build()))
.build(),
RC_SIGN_IN);
}
}
};
The logcat shows no error or anything. I would post the logcat when this happens but I don't know how to get the logcat from a signed apk cause this only happens on sign the apk.
I have tried to figure this out for days but seem to be making no head way.
Thanks
You have added the signature of the debug key in the console. But the signature of release key is different. Add the signature of release key that you used to sign the apk in the firebase console.
First generate key using following command:
keytool -list -v -keystore KEYSTORE_PATH -alias ALIAS_NAME
Then copy the SHA-1 checksum and go to:
Firebase Console > Your project > Settings of the app > Add Fingerprint
Google is getting more and more ugly, they're making simple things complicated. The problem is the third key,
1、the debug key
2、the release key
3、Google Play App signing key
You need THREE keys to figure out ONE Google SignIn.
Does facebook also need three keys? Maybe one day google will need 30 keys.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With