Google sign-in Android with Firebase - statusCode DEVELOPER_ERROR

♀尐吖头ヾ 提交于 2019-11-28 09:03:31
Ian Barber

DEVELOPER_ERROR means Google Play services was unable to find a matching client from the console based on your SHA1 and package name. You can add SHA1s in the settings page on the Firebase console for a given package name, or add a new package name through the Add Firebase to your Android app button.

In general, some things to check for:

  • Make sure your package name is what you expect - e.g. its the one in your build.gradle, and its not being overriden in a build variant or product flavor.
  • Make sure you have registered your debug and release SHA1 keys in the console.

If Google Play App Signing is enabled for your app, then it will replace your release signing key with the one on Google's server before publishing.

You can check if it is enabled from: Google Play Console -> Release Management -> App Signing.

In my case, to resolve the error I had to:

  1. copy the SHA1 from the 'App signing certificate' section
  2. add it to the Firebase projects general settings section
  3. regenerate the json file
  4. add it to the project
  5. re-upload the apk

Error code 10 is constant value of CommonStatusCodes.DEVELOPER_ERROR which implies you have misconfigured your project

What you can do

  • check if SHA from PlayStore Console and Firebase Console are same.

    Copy SHA from Google Play console

paste it into Firebase Console

What else you can do?

Display meaningful messages in plain English case of failure

          // Google Sign In failed, update UI appropriately
            Log.w(TAG, "Google sign in failed", e);

            String messageToDisplay = "Authentication failed.";
            switch (e.getStatusCode()) {
                case CommonStatusCodes.API_NOT_CONNECTED: //17
                    messageToDisplay += "The client attempted to call a method from an API that failed to connect.";
                    break;

                case CommonStatusCodes.DEVELOPER_ERROR: //10
                    messageToDisplay += "The application is misconfigured.";
                    break;

                case CommonStatusCodes.ERROR: //13
                    messageToDisplay += "The operation failed with no more detailed information.";
                    break;

                case CommonStatusCodes.INTERNAL_ERROR: //8
                    messageToDisplay += "An internal error occurred.";
                    break;

                case CommonStatusCodes.INVALID_ACCOUNT: //8
                    messageToDisplay += "Invalid account name specified.";
                    break;

                case CommonStatusCodes.SIGN_IN_REQUIRED: //8
                    messageToDisplay += "Please Sign In to continue.";
                    break;
            }

            Toast.makeText(LoginActivity.this, messageToDisplay,
                    Toast.LENGTH_SHORT).show();
Ismael Junior

I had the same problem. What happens is this you have a SHA1 debug and release SHA1. Normally we used only SHA1 Debug and generate the .apk signed to google play, but when we use google sigin you must enter the firebase release of SHA1.

To view the release SHA1 use the following command:

 keytool -list -v -keystore C:\ProjectsData\keystore\my-release-key.keystore -alias alias_name 

Then enter this SHA1 on the Firebase

https://support.google.com/firebase/answer/7000104

This answer SHA1:

SHA-1 fingerprint of keystore certificate

Hope I helped you.

I created new debug SHA1 key using following steps and replaced SHA1 key in my project settings. it worked for me.
-Open Your Project.
-Click on File menu -> New -> Click on Google -> Select Google Maps Activity -> Click on Finish. -Android studio would generate automatic google_maps_api.xml file.
-You can get debug SHA1 key in this file.

Replace this SHA1 key in project settings, Then download new google-services.json from settings and replace it in your project as your certificate_hash and client_id will change.

I had the same issue and I got it working by doing these steps:

1. Add DEBUG_KEYSTORE SHA1 fingerprint to the firebase project. use the following command(MAC/LINUX)

keytool -exportcert -list -v \-alias androiddebugkey -keystore ~/.android/debug.keystore  

2. Now Generate a signed apk of your project. The process includes generating a keystore for your app's release version. Copy the path of the newly generated .jks file.

3. Now generate RELEASE_KEYSTORE SHA1 fingerprint using the following command

keytool -list -v -keystore FULL_PATH_TOJKS_FILE -alias ALIAS_NAME

4. Copy the new SHA1 from the output and add it as another SHA1 fingerprint in your firebase application console.

Now you are good to go! ---- Hope! it helps.

I think you need to change your play-service version.

See Firebase Android Codelab to add Firebase Auth dependency to your app/build.gradle file.

Try to update your play-service in gradle as below:

/* For Google Play Services */
...
compile 'com.google.android.gms:play-services:9.0.0'
...

DEVELOPER_ERROR :

The application is misconfigured. This error is not recoverable and will be treated as fatal. The developer should look at the logs after this to determine more actionable information.

While creating the OAuth key, you need to make sure you are giving correct package name. This means the package name that comes in your manifest file.

If you are using multiple modules (e.g. some library like FirebaseUI-Android), then make sure while creating the key, you use the package name from which you request Google authentication.

I had the same issue. After 2 days of pain, I observed that my release SHA1 was incorect (I used to get it using the keytool in java/bin and it gave me a bad SHA1. Probably because now Android Studio uses its own java package and not the JDK). Better way to get the corect SHA1 here SHA-1 fingerprint of keystore certificate

Prashant Gosai

Click Here (Google Developer guide line) and create new project for Firebase console this link is set with default setting, so you don't need to add it manually

Had the same issue. But worked fine after I cleaned and rebuilt the project. :D

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!