Below code I am using for Google login.I added google-services.json file in the app folder.I am using classpath \'com.google.gms:google-services:2.0.0
It's likely that your issue is in that you picked the SHA1 from the ~/.android/debug.keystore, but not using it to sign your build.
Go to the module options Signing tab and add a profile with the only field Store File set to /Users/<your_user>/.android/debug.keystore
On the Flavors tab pick it in the Signing Config drop-down.
On the Build Types tab pick it in the Signing Config drop-down for your build type (likely to be Debug).
Cleanup and rebuild.
Thanks Aleksey Gureiev for hinting... I solved my problem by making sure debug keys are actually used during builds..
For me in Android Studio the issue was the Signing Config was not set at all. I am still wondering how it happened.
Once I set Signing Config to my config with name "debug" then it all started working.
If you are working in two computer different, you have to generate the SHA1 again and add to console.firebase.google.com, download the google-service.json and add in your project
Use .requestIdToken(BACKEND_CLIENT_ID) with your GoogleSignInOptions.
How to get the BACKEND_CLIENT_ID can be found here: https://developers.google.com/identity/sign-in/android/start-integrating#get_your_backend_servers_oauth_20_client_id
Hope this helped!
I have same problem and this solution has worked. Hope this will help you and others.
Apply the plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
Make Sure this applicationId is same as your package name in Manifest file (Upper case and lower case matters)
applicationId "com.example"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
I faced the same issue with my React Native project.
I had to generate SHA-1 key using debug.keystore in android/app folder.
Run the below command in the terminal after changing your directory to cd C:\Program Files\Java\jdk1.8.0_251\bin. (You may have a different JDK version).
keytool -list -v -keystore "D:\{ProjectName}\android\app\debug.keystore" -alias androiddebugkey -storepass android -keypass android