I am trying to integrate a Google plus Login in my application as per the instruction provided by following link : https://developers.google.com/+/quickstart/android#install-sdk
I am following all the instructions perfectly. And when I run the sample application on a real device provided in the android-sdk and click the signin
button, it display a Toast message that An internal error occurred
What am I doing wrong?
Something often overlooked is the package name. I'd like to clarify the step 6 by Eric Leschinski above (can't comment there): the required package is not the package of an activity, rather the package of your app's manifest.
You may retrieve the correct value from the root element of AndroidManifest.xml:
In this example define "com.ntk.darkmoor" while creating the Client ID
I've solved problem by removing
.setScopes("PLUS_LOGIN")
in the PlusClient.Builder.For me it was that i was attempting to use my production key when installing it using my debug key. Make sure your using the right SHA1 from the right keystore.
I turned around to the Google IO 2013, and changed the initialization of PlusClient, then it works.
I had the same issue when I used SHA1 for debug.keystore for debuging then exported my application forgetting to generate SHA1 for keystore that I used to export my application.
I have been searching how to fix this for a day with full of research without luck finally i managed to resolve this issue with the following approach.
Before i begin resolving this (at least how ti worked for me) i have to say that everything on the documentation is correct and you don't have to change any lines of code or so. It looks like more of a bug in the https://cloud.google.com/console cloud console
First ensure you got the correct SHA1 and your project's package name as described in the docs https://developers.google.com/+/quickstart/android
Now this bug as i noticed (at least for me) was that in my cloud console, the project i have created was long ago with the old interface and few months ago i migrated to the new GUI.Once you get the new look on cloud console you will notice that new projects have an auto generated project id like this atlantean-ares-331 while old projects got a long integer value as project id which is not visible. So if your project was created with the old GUI and you have just created new client id for OAuth for that project you will get the Toast "An internal error occurred” while trying to sign in with google.
How to Fix
Ensure that none of your projects has the same package name on OAuth Client ID with the one you will use now otherwise you will get Error
This client ID is globally unique and is already in use
.(you will have to delete the old OAuth client id with the same package name you will use now).Go to Credentials Create New Client ID for OAuth.
Installed application
Android
Enter your project's package name and your SHA1
Done