21

I try to implement Google login in my Firebase connected Android app. When I run the app and press Google Sign In button - nothing happen. And I receive this error in onActivityResult: Status{statusCode=DEVELOPER_ERROR, resolution=null}.

My code looks like this:

     protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (requestCode == REQUEST_CODE_GOOGLE_LOGIN) {
        GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);

        if (result.isSuccess()){
            GoogleSignInAccount account = result.getSignInAccount();
            String emailAddres = account.getEmail();
            getGoogleQAuthToken(emailAddres);
        }
    }
}

         private void getGoogleQAuthToken(final String emailAddres){
             AsyncTask<Void,Void,String> task = new AsyncTask<Void, Void, String>() {
                 String errorMessage = null;

                 @Override
                 protected String doInBackground(Void... params) {
                     String token = null;
                     try {
                         String scope = "oauth2:profile email";
                         token = GoogleAuthUtil.getToken(MainActivity.this, emailAddres, scope);
                     } catch (IOException transientEx) {

                         errorMessage = "Network error: " + transientEx.getMessage();
                     } catch (UserRecoverableAuthException e) {
                         Intent recover = e.getIntent();
                         startActivityForResult(recover, MainActivity.REQUEST_CODE_GOOGLE_LOGIN);
                     } catch (GoogleAuthException authEx) {
                         errorMessage = "Error authenticating with Google: " + authEx.getMessage();
                     }
                     return token;
                 }

I've added JSON config file in app/ directory and added dependencies:

     buildscript {
repositories {
    jcenter()
}

dependencies {
    classpath 'com.google.gms:google-services:1.5.0-beta2'
}
     }


     dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.+'
compile 'com.firebase:firebase-client-android:2.3.0+'

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

compile('com.afollestad.material-dialogs:core:0.8.3.0@aar') {
    transitive = true
}

/* Firebase UI */
compile 'com.firebaseui:firebase-ui:0.2.2'

compile 'com.android.support:cardview-v7:23.1.+'
compile 'com.android.support:recyclerview-v7:23.1.+'
compile 'com.android.support:design:23.1.+'


     }
     apply plugin: 'com.google.gms.google-services'

I am looking for solution hours already... Please help!!

Frank van Puffelen
  • 418,229
  • 62
  • 649
  • 645
user5866501
  • 363
  • 2
  • 3
  • 11

13 Answers13

25

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.
Gastón Saillén
  • 9,076
  • 4
  • 39
  • 58
Ian Barber
  • 18,936
  • 3
  • 52
  • 57
  • 1
    my package name and SHA1 are registered on the console, i had imported an existing google app and i have also included the json file in app directory. Still i'm stuck with the same error. – SKen May 26 '16 at 16:10
  • 2
    Couple of things to check: Check they're registered as a client ID/connect app, and not as an API key. Also, try inspecting your APK with aapt to make sure its really using the SHA1 and package name you intended: sometimes it can be pulling a different keystore than expected, or a gradle rule is tweaking the package name. – Ian Barber May 26 '16 at 16:39
  • I understand that your answer is the most probable reason, especially since my release build with a different keystore worked perfectly. But, my debug ey has been the same and there is no change in either my SHA1 key nor my package name. I still can't get it to work on debug builds. – SKen May 31 '16 at 18:36
  • Possibly something is cached locally on the device with a bad state - in the Google Settings app you can clear third party data which should flush it, or try on a fresh device or simulator. – Ian Barber May 31 '16 at 20:25
  • Have also tried that, I have a bunch of test devices which i have tested it with. – SKen May 31 '16 at 20:28
  • Is the client ID that has the debug SHA1 and package name in the same console project as the release client ID (that works)? If not, wondering if an API is disabled on the debug project: could you compare the list of enabled projects on https://console.developers.google.com/ ? – Ian Barber May 31 '16 at 22:01
19

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
g2server
  • 4,387
  • 3
  • 25
  • 36
  • This was the case for me 100%. My other app, has no "App Signing" activated through Google Play Console. But for some reason, my new one has - which changes the SHA1 when uploaded / released through Google Play. – Oakleaf Oct 18 '17 at 21:07
  • Is this need it even if I just want to test this locally? – Raul H Sep 19 '19 at 16:27
  • @RaulH no, it should only be required for release builds that are published via Google Play Console, and when Google Play App Signing is enabled. – g2server Sep 19 '19 at 22:53
  • thank you man. it's Worked for me. after adding SHA1 in firebase no need to re-upload the APK. – shammi Feb 07 '20 at 08:10
9

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

    enter image description here

paste it into Firebase Console

enter image description here

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();
Hitesh Sahu
  • 31,496
  • 11
  • 150
  • 116
6

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.

Community
  • 1
  • 1
Ismael Junior
  • 570
  • 1
  • 5
  • 7
1

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

Julian Raj
  • 62
  • 2
1

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.

Srikanth
  • 1,485
  • 9
  • 16
1

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.

Udit Kapahi
  • 2,149
  • 1
  • 24
  • 24
0

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.

pRaNaY
  • 21,330
  • 22
  • 85
  • 134
0

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.

jaibatrik
  • 5,072
  • 6
  • 28
  • 60
0

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

Dan Alboteanu
  • 6,336
  • 1
  • 37
  • 33
0

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

Awais Saifi
  • 59
  • 1
  • 8
Prashant Gosai
  • 1,097
  • 1
  • 10
  • 14
0

If your app is on release mode/production, then you have to get the SHA1 from your-release-store.keystore. If your app is on development mode, then you have to get the SHA1 from your-debug-key.keystore. Copy all the SHA1 to your Firebase project settings > add fingerprint.

This is how to get the SHA1 from your keystore file:

keytool -exportcert -keystore ~/pathtoyourkeystore/yourfile.keystore -list -v
fxbayuanggara
  • 138
  • 1
  • 14
0

After spending two hours on this. Trying out everything mentioned here and on this github issue. I still got the same developer error.

What worked for me is to force android studio to use a new debug signing key and add the new key to firebase console.

When you generate the signingReport in android studio it also print where your keystore is located. Something like:

> Task :app:signingReport
Variant: debug
Config: debug
Store: C:\Users\<Username>\.android\debug.keystore
Alias: AndroidDebugKey
MD5: E0:....
SHA1: DD....
SHA-256: B2:81....
Valid until: Thursday, 23 March 2051
----------

I renamed the debug.keystore to debug.keystore_ and the lock file also. Then I did a clean and rebuild in android studio. It automatically created a new keystore. Use the signingReport again and add the new key to the firebase console project.

This solved the issue for me.

Note: To double check the package name of the debug apk. Use the aapt2 tool: https://developer.android.com/studio/command-line/aapt2

By default, it was located in the android-sdk\build-tools\<version>\aapt2.exe path for me.

aapt2 dump packagename <projectpath>\app\build\outputs\apk\debug\app-debug.apk

Though it was the same for me as the manifest and the build.gradle one.

szab.kel
  • 1,831
  • 1
  • 30
  • 60