I've searched and tried almost everything given on Google Developers website, Stack Overflow and other helpful blog posts. But nothing has worked for me.
My app was successfully signing-into the Google account but when I made some basic changes in the app (not related to Google API at all) and uploaded the updated APK on playstore, Google Sign-In hasn't worked after that.
When I run the app from Android Studio (using debug build-variant and release build-variant), sign-in works like a charm. Then I generate the signed-apk and upload it on Play Store. And when I install app from Play Store, it doesn't sign-in and gives statusCode=DEVELOPER_ERROR
I've created the project on Google Cloud Console, created OAuth 2.0 client ID for Android inside that project and added SHA1 (generated for release) inside that client ID. Then I downloaded google-services.json file and placed it inside app folder of my project.
I don't seem to miss anything. But sign-in still doesn't work. Please let me know what's the problem.
P.S.: Firebase is also integrated into my Android Project.
Here is the set-up code for GoogleApiClient inside onCreate()
googleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(MainActivity.this, this)
.addApi(Auth.GOOGLE_SIGN_IN_API, signInOptions).build();
googleApiClient.connect();
This is the method invoked when Sign-In button is clicked.
public void signIN() {
Intent intent = Auth.GoogleSignInApi.getSignInIntent(googleApiClient);
startActivityForResult(intent, REQ_CODE);
}
This is the code from onActivityResult()
if (requestCode == REQ_CODE) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
if(result.isSuccess()){
GoogleSignInAccount account = result.getSignInAccount();
//Do something
}else{
Toast.makeText(getApplicationContext(), "Unable to Sign in. Try again.", Toast.LENGTH_SHORT).show();
}
Log.d("GoogleResult", result.getStatus().toString());
}