Related
private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
try {
GoogleSignInAccount account = completedTask.getResult(ApiException.class); //exception is here
// Signed in successfully, show authenticated UI.
System.out.println("google token ---> " + account.getIdToken());
} catch (ApiException e) {
// The ApiException status code indicates the detailed failure reason.
// Please refer to the GoogleSignInStatusCodes class reference for more information about this error.
e.printStackTrace();
}
}
Quoting the documentation:
Certain Google Play services (such as Google Sign-in and App Invites)
require you to provide the SHA-1 of your signing certificate so we can
create an OAuth2 client and API key for your app.
If you are using Firebase and try on the debug app :
1. First, get your SHA-1 debug key :
Click on Gradle (From Right Side Panel, you will see Gradle Bar)
Click on Tasks
Click on Android
Double Click on signingReport (You will get SHA-1 and MD5)
2. Add your key to your Firebase project :
Go to Project settings -> SHA certificate fingerprints -> Add SHA-1 key of debug app.
Then you can update your google-services.json file in your Android project.
Its works for me.
This status code means that you are providing unknown server client id.
In https://console.developers.google.com/apis/credentials in your project you might need to generate: OAuth client ID -> Web Application and use this web application client id here:
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(webApplicationClientId)
.requestEmail()
.build()
I have solved this problem using these steps:
1). Goto https://console.developers.google.com/ and delete (Android Client) if it is created.
2). Click on Create Credential and click on OAuthClientID and select android
3). copy and paste your SHA 1 fingerprint
4). type your package name then saved
5). Goto console.firebase.com
6). download google-service.json move it into your project into app directory
7). Open google-service.json and find out client id type 3 and use it as default_web_client_id
8). Run your App
I have this thing in 2-3% of the occasions in production and it works seamlessly for everyone else.
Given the sheer amount of problems and differing answers this is causing, it's fair to say that this is a problem on behalf of firebase. They've implemented a catch-all error routine that is just bad api design. The api must point to the problem where it fails.
A long term solution is to convince firebase that this is bad-api design and they need to do better.
We're strong together.
Please write a support ticket to firebase roughly with this:
Hey Firebase Support,
i have a com.google.android.gms.common.api.ApiException: 10 in my app.
The problem for me - and for a lot of people all over the forums - is
that your api seems to have a catch-all error routine that roughly
speaking is saying "something went wrong, please fix it".
You could release your support team and a lot of people from headache
if you would fix this.
The API should be able to figure what's wrong and give a better error
message from the context where it occurs.
It's really a burden and I think that since firebase has a
quasi-monopoly on these matter on Android it's your obligation to do
better.
While this is obviously not your fault, I'd like to encourage you to
escalate this problem.
It's fundamentally bad api design and harms an otherwise great
product.
Thanks anyway.
My problem was trying to use Google Sign-In yet I had accidentally enter the wrong SHA1 in Firebase. Try running Gradle > Your app name > Tasks > android > signingReport, get your SHA1 key and compare it with the one on Firebase. If they are different, change the Firebase SHA1 key to match the one you got from the signingReport. Don't forget to also download the google-services.json afterwards.
The ApiException Error Code 10 is a developer error. You get this error when your firebase app is not well configured. One sure case is when you do not supply the SHA1 fingerprint for your android app when you want to use Firebase authentication with Google Signin. (It is a requirement for Google Signin).
So supply the SHA1 fingerprint, download the google-services.json configuration file to your app folder and build. You should be good to go.
Google sign-in is automatically configured on your connected iOS and web apps. To set up Google sign-in for your Android apps, you need to add the SHA1 fingerprint for each app on your Project Settings.
Check this out Common Status Error Codes
In my case the problem was with the SHA1 and google-services.json file
i solved the problem follow this steps:
1.- Open https://console.cloud.google.com/apis/credentials and delete file at OAuth 2.0 Client IDs
2.- Open https://console.firebase.google.com/ clic gear icon -> Proyect Settings -> Select your Android App -> add fingerprint -> save -> and download google-services.json file
3.- Open your android proyect and replace de google-services.json file -> clic Sync Proyect with Gradle Files
4.- The new default_web_client_id at values works fine for me and solved the problem
that is because you are using the wrong default_client_token_id.
to solve this go to the JSON file downloaded from firebase and open it:
your client_id is located right after the
"certificate_hash":xxxxxxzxzxzzzxzxzxzxzxzx....
good luck :) and I hope it helped.
Don`t forget to add
<application
...
<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />
...
</application>
under your manifest file application tag.
In my case problem was because of absent this lines.
ApiException 10 is a DEVELOPER_ERROR, which means something's wrong with your app configuration.
This answer worked for me, but then I realized our app authenticates with a backend server. So, if your app authenticates with a backend server, you only need to use the web application client ID. But you still need to create client ID of Android type or you're going to get ApiException 12500 . You can read more about it from the documentation. (note that the link has authuser=0)
If you remove this line it will work:
System.out.println("google token ---> " + account.getIdToken());
This is because you don't have the request to the idToken:
.requestIdToken(getString(R.string.google_app_id))
where the app_id will have the value of "OAuth client ID -> Web Application"
When you are doing setup of google login, it normally take Signed keystore hash key. So try with signed APK then it will work. For debugging try to add your debug SHA key on google console.
I guess the question is answered. But for me it was a little different. So
if some googlers come along this and may have the same problem as I had:
Special Case
multiple firebase projects
client ids whitelisted
installed app through app sharing can't sign up with google
In case anybody is using multiple firebase projects for one application (i.e. for different flavors) and has whitelisted the "external" client ID in Google-Authentication in one project.
Then the solution is, to generate new credentials in the Google APIs console of the "master" / whitelisted project with the sha-1 (found in app sharing) of the other project.
Add new credentials to API Console
Go to Google APIs of whitelisted project
Create new OAuth Client ID
Add everything needed, also package name of other project
Paste the SHA-1 hash from App Sharing of other project
Done
Sorry for my bad english. It's not my mother tongue.
This Error because of Wrong Client Id
GoogleSignInOptions googleSignInOptions = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build();
You must pass your server's client ID to the requestIdToken method.
client Id can be found eaisly in google-services.json file
{
"client_id": "",
"client_type": 3
}
No need to go to Credentials page in the GCP Console.
Please to follow instructions from
https://firebase.google.com/docs/auth/android/google-signin
If you came here because of an error with the Google Login iOS & Android Unity library, this is what helped for me.
I changed the Google project and kept getting ApiException: 10. I later found out that it was because you need to use a web client, not an Android one.
If you want to check if you have a web client or an Android one, open the client_secret_(some text).apps.googleusercontent.com.json file - if it starts with {"web" it's a web client.
Step by step instructions for replacing the client:
Remove the client_secret_(some text).apps.googleusercontent.com.json file from your Unity project. If you have a plist file (for iOS) too, don't remove it.
Go here, click "Configure a project" and configure an Android client.
Go to the Google Cloud Credentials page (select your project if necessary), download the auto-generated web client and place it in your project.
Click Assets > External Dependency Manager > Android Resolver > Force Resolve.
Change the client ID passed to LCGoogleLoginBridge.InitWithClientID in the script where you call this function.
Build and see if the issue has been resolved.
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(OAUTH_2_CLIENT_ID)
.requestEmail()
.build()
val mGoogleSignInClient = GoogleSignIn.getClient(this, gso)
val signInIntent = mGoogleSignInClient.signInIntent
startActivityForResult(signInIntent, GOOGLE_LOGIN)
OAUTH_2_CLIENT_ID is Web client (auto created by Google Service). Not Android
If you don't use your own backend server you don't need to provide OAuth 2.0 client id (as it said here). Of course check that you provided correct SHA-1 code, but remember that you are providing the release variant SHA-1 key, so this error might appear when you are trying to use Google SignIn with debug app variant. So you have 2 options:
Build and run release APK
Add your debug SHA-1 key to the Firebase console and then you'll be able to run your debug APK without this exception
Possible solve:
If you once renamed project's package check that package name in AndroidManifest.xml and applicationId in app gradle file are the same.
It helped me when I named applicationId like my application package
From my experience it is a problem with SHA1. Solution which worked for me:
Delete OAuth listings if you have created any (probably optional)
Launch this command in your project terminal keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android and copy SHA1 fingerprint.
Go to Firebase console, click gear on your project and delete old fingerprint's. Replace them with the one you copied during step 2
Download new google-services.json file and replace the old one
Sync project with Gradle files.
Should be working :)
I was facing the same issue. I was using SHA-1 credentials. But the problem was that I was directly installing the app to the testing device by using the Run button of Android Studio. In this way, I hadn't defined the debug keystore in Android Studio with which I had created the SHA-1 fingerprint.
To set the debugKeyStore Where is debug.keystore in Android Studio
In my case, it resolved by reconnect my Android Studio to Firebase.
I was getting the same error but I obtained the web client token from Google Cloud Console and placed it right where the GoogleSignInOptions is declared. Replace the
.requestIdToken("getString(R.string.default_web_client_id)")
with the web client ID for your particular Google Cloud project.
I were using this command from documentation ...
keytool -exportcert -keystore ~/.android/debug.keystore -list -v
i just change it to
keytool -exportcert -keystore ./.android/debug.keystore -list -v
and using SHA-1 and copy it into firebase android section.
it just wokrs fine.
For me the mistake was simple. I had initialized google signin options outside the oncreate callback.
If using Google Internal Sharing for testing, make sure to add also the SHA string of your internal sharing (Setup - Internal App sharing in Google Play Console)
I solve this problem by redo my Firebase Auth connection again.
Click the right top little square to login to your google account
Go to the Tool - > Firebase
Select the Authentication
Connect
After that it may say you are already connect, but you need to update the connection. After that it works fine. I think sometime Android Studio mixed up with different Firebase account.
In my project PlacePicker was working fine but today suddenly its closing immediately after launch with resultCode 2.
here is the logcat output
07-06 16:06:36.596 1023-20519/? W/Places﹕ e.a:638: gLocReplyElement
unsuccessful status: 1
07-06 16:06:36.596 1023-20519/? W/Places﹕ e.a:665: gPlaceQueryResult
unsuccessful responseCode: 26
07-06 16:06:36.596 21086-21708/? E/PlacePicker﹕
PLACES_API_QUOTA_FAILED
Any idea? what is the meaning of PLACES_API_QUOTA_FAILED error code?
Assuming you have the Place API for Android enabled and your API key is correctly configured in your manifest, this could also happen if you are missing your SHA-1 certificate fingerprint(s) in your developer console. So, make sure you have the following covered:
In the developers console make sure you have the API key generated for your android app and make sure the API key is entered in your manifest file. It should be a meta tag nested inside the application tag.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.my.awesome.app">
<application>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIza..."/>
... other stuff
</application>
</manifest>
On the same page as your API key, at the bottom, you need to enter the package name from your manifest and the certificates. While in development/debug mode you can use the certificate from the debug keystore supplied by the studio, however, for the release version you'd have to generate your own keystore.
To generate the keyhash for the debug mode:
keytool -exportcert -alias androiddebugkey -keystore C:\Users\{username}\.android\debug.keystore -list -v
Same command is used for the release version, but this time you'd need to point to your own keystore.
More info here
See here for info on the error code... It might throw a better error by now, but that used to mean something is wrong with your certificate fingerprints in the API Console.
We were having a similar problem (PlacePicker closing immediately with result code 2, except we did not have any relevant console output). We ended up fixing our issue by removing all fingerprints to get it working and then slowly adding security back:
Remove all entries under "Restrict usage to your Android apps" on the page for your api key in the credentials section of the Google API console
On the same key page, click "regenerate key" at the top (yes -- this was actually required for us #_#... you could try the old key again before doing this)
Test your app with the new key
If PlacePicker is now working, try adding security back in:
https://developers.google.com/maps/documentation/android-api/signup
Other info
Our devices were running Android API level 23 (Android 6.0)
Our app / module level build.gradle is using:
compile 'com.google.android.gms:play-services-maps:9.0.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.google.android.gms:play-services-location:9.0.0'
Our project level build.gradle is using:
classpath 'com.google.gms:google-services:3.0.0'
```
The Google Places API for Android enforces a default limit of 1 000 requests per 24 hour period. If your app exceeds the limit, the app will start failing.
You can find complete explanation here
https://developers.google.com/places/android/usage
I created a map using the following link http://developer.xamarin.com/guides/android/platform_features/maps_and_location/maps/part_2_-_maps_api/ i followed all the procedures mentioned in it but what am getting is a blank screen. My application Output shows the following log on executing the map activity.
Open Connection [REQUEST] DRD(41): 62|147 [REQUEST] Close [REQUEST] Error processing: com.google.maps.api.android.lib6.b.d#42a1cef8 not retrying [REQUEST] Retrying: com.google.maps.api.android.lib6.c.au#429ced70
Can anyone please tell me why this is happening.
If you are unable to view the map after deploying a Release apk, follow this Video..
https://www.youtube.com/watch?v=xLJ0jDFdUZ0
As it says :
Create a KeyStore from Visual Stuido.
a. Put project config mode to Release.
b. Clean and Build your Android project.
c. Right click your Android project and select Archive (Before that specify the version code and version name in your manifest or in properties).
d. Once the archive is completed, click on Distribute.
e. Select AdHoc channel.
f. Create a new Signing Identity with Alias, Password and other info.
g. This signing key creates a KeyStore file in location :
C:\Users\[UserName]\AppData\Local\Xamarin\Mono for Android\Keystore\[Alias]\[Alias].keystore
Note : [Alias] is the name you defined when creating the KeyStore file
Open your cmd. cd to C:\Program Files\Java\jdk1.8.0_131\bin
Execute : keytool -list -v -keystore "C:\Users\[UserName]\AppData\Local\Xamarin\Mono for Android\Keystore\[Alias]\[Alias].keystore" -alias [Alias]
You will get the output with MD5, SHA1, SHA256... Copy the SHA1 key.
Go to https://console.developers.google.com . Select your project you created for Android API key.
Click on credentials and select your API key.
Add new Package name and finger print with your project's package name and SHA1 key you copied.
Note : Project's package name defined on Android Project's manifest and properties.
Wait for like 5 mins to take the changes to affect. Afterwards you can again archive and get a new APK. Install on your android device and see. You will now be able to see the map.
NOTE :: I am referring to Xamarin, Visual Studio 2017
As #Miha mentioned this is keys related.
At present you will not be getting any map tiles displayed on the map.
To get the example to work there are several things that you need to do.
1) Obtain your Signing Key Fingerprint (SHA1) for your machine.
If you haven't already created your SHA1 key for your machine you will need to do this first. The link here describes how to generate this using the command console.
You will get a SHA1 key fingerprint as a result of this.
2) Obtain the package name from the project you are working on.
This can be located by looking at the Android project properties under the Android Manifest tab. You will then see a text-box for the Package name field.
3) In Google Developer Console you will need to create an Application should you not already have one, and Create A New Android key (This is located under APIs & auth \ Credentials).
On the screen that will pop-up you will be able to enter in the SHA1 key and Package Name that you have previously captured in the format {SHA1};{Package Name}.
This will then return to you the API key that you will use in the next step:-
4) In the Android Project, look at the source for AndroidManifest.xml. You will see the following:-
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="{some api key}" />
Enter you API key in that you have previously captured.
5) In the Google Developer Console, for the project, you also have to remember that you have to enable Google Maps Android API v2 and also Google Play Android Developer API. You can find these under APIs & auth \ APIs
You should then, finally, be able to run the demo.
Update 1:-
Add the uses-permission for MAPS_RECEIVE as #leoneboaventura mentioned also, so something like the following:-
<uses-permission android:name="{your-package-name}.permission.MAPS_RECEIVE" />
I just figured out what was wrong in my case. Probably because of Java naming rules, you have to name your package with the first letter in lowercase. Visual Studio names our packages following C# naming rules, which spells the first letters capitalized.
So, check if this issue isn't the same causing your map to don't open by doing the following:
1) Make sure your package name starts with small letter.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="mypackage.android" android:versionCode="1" android:versionName="1.0">
Make sure your package is named mypackage.android not MyPackage.android.
2) Make sure your package name in the following two permissions matches the manifest package name spelling:
<uses-permission android:name="mypackage.android.permission.MAPS_RECEIVE" />
<permission android:name="mypackage.android.permission.MAPS_RECEIVE" android:protectionLevel="signature" />
3) Check if you APIKey is been generated to the same package name:
{your SHA1 certificate fingerprint}:mypackage.android
Change AndroidManifest.xml like this
<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
<application ...>
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="yourApiKey" />
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
</application>
<queries>
<package android:name="com.google.android.apps.maps" />
</queries>
</manifest>
I am displaying MAP using google map Api V2 i successfully displayed it in device when am running through my PC but now i am signing my application via export signed apk and made as .keystore and .apk and it made a certificate and now i am using that apk file and runnning the application but the map does not displayed just showing white screen, even i made a release key using
http://developer.android.com/tools/publishing/app-signing.html and i succesfully performed all the steps given in the link but then too the map is not displaying, please help.
Thanks.
You must need to create new map api key with your newely create keystore and put it on Google Map Api Console page. Use below command:
PATH OF YOUR KEYTOOL FILE/keytool -list -v -keystore YOURKEYSTORENAME
You will get SHA-1, save it. Go to Google api console page, create new Android key using this SHA-1 and put newely created key into your app. It will work for sure.
you need to sign your maps with release key ;) you signed your map with debug.keystore
how to get a Google Maps API v2 release key
Google Maps v2 Getting started
My public class VentanaMapa extends FragmentActivity
when private GoogleMap mMap;
status = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(getBaseContext());
Intent intentErrorMapa = null;
switch (status) {
case ConnectionResult.SUCCESS:
SupportMapFragment SupportMap = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mMap = SupportMap.getMap();
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
mMap.getUiSettings().setZoomControlsEnabled(true);
mMap.getUiSettings().setCompassEnabled(true);
new ObtenerEnvio().execute(_empAlbaran, _codAlbaran.toString(),
_lineaAlbaran.toString());
mMap.setMyLocationEnabled(true);
break;
case ConnectionResult.SERVICE_MISSING:
Toast.makeText(VentanaMapa.this, R.string.ErrorMapaServiceMissing,
Toast.LENGTH_LONG).show();
break;
case ConnectionResult.SIGN_IN_REQUIRED:
Toast.makeText(VentanaMapa.this, R.string.ErrorMapaSignRequired,
Toast.LENGTH_LONG).show();
break;
case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
Toast.makeText(VentanaMapa.this, R.string.ErrorMapaServiceUpdate,
Toast.LENGTH_LONG).show();
break;
case 999:
Toast.makeText(VentanaMapa.this, R.string.ErrorCargarMapa,
Toast.LENGTH_LONG).show();
break;
}
My Map.xml:
`<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_above="#+id/ImageButtonAnteriorMapa"
android:layout_alignParentTop="true" />
</RelativeLayout>
1) create a release key, for sign your app. SHA1 that you have you need to go to Google Api console. Create new Android key like SHA1_number;your.package
2) with this key you need to add in your manifest like:
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="your_key_for_release" />
your put that code before </application>
that's it. check logcat to see exactly which message you recive from Google Maps
I Faced the Same Problem,Finally Got a Solution, Kindly check your Developer Account,It have permission for Api key generation follow this steps to show your map in google play signed apk
1. Create the Api using Debugging SHA1.
(eg)F0:0F:F0:0F:F0:0F:F0:0F:F0:0F:F0:0F:F0:0F:F0:0F:F0:0F:F0:0F;com.blabla.app
2.Create the Api using Relased SHA1 from appname.keystore.
(eg)F2:83:F2:83:F2:83:F2:83:F2:83:F2:83:F2:83:F2:83:F2:83:F2:83;com.blabla.app
you have an option to create on this api in single textfield in developerId api console page.
This kind of option are available only in developer account.Try it.Thank you.
Please refer the following Image if u have any doubt.
In the Google API console have you add your signed sha1 Key and change it in your Manifest.xml ?
Because, signed and debug keystore and completely different, with Eclipse, when you Export your project as an Android Application, you choose a keystore and before clicking finish, there is a sha1 key at the bottom of the window. You've to add this specific key in the API Console.
try this
1.first create the .APK file in eclipse in the console as shown this see this image
2.copy the SHA1 key and then create the API Key
using this .Google APIs Console
3 and past the API key into ur project and then create the APK file
To find out the Android SHA1 fingerprint for release keystore, follow these steps:
Open terminal
Change the directory to the JDK bin directory, mine was jdk1.7.0_05 (could be different for you).
cd C:\Program Files\Java\jdk1.7.0_05\bin
Next we have to run the keytool.exe. Use the following line to get the SHA1 fingerprint.
keytool -list -v -keystore {keystore_name} -alias {alias_name}
Example:
keytool -list -v -keystore C:\Users\MG\Desktop\test.jks -alias test
It will prompt for a password.
Enter the password, you will get the SHA1 and MD5 fingerprint.
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?
I have this problem and even after creating 10 different client IDs with different SHA and package name, it doesn't work... until I found out that you have to fill the Consent screen.
According to GoogleDevelopers Console -
The consent screen will be shown to users whenever you request access
to their private data using your client ID.
This can happen when you haven't set the signature for the client ID in your API console project, or if you copied the wrong key value from keytool. Doing so is documented in the steps of the quick start guide on steps 7, 8, 9, and 10.
I've solved problem by removing .setScopes("PLUS_LOGIN") in the PlusClient.Builder.
I got this toast message error in my android application:
An internal error occurred
Summary:
Assuming you made a mistake configuring the negotiation between your android app and the Android API server granting you access. Most likely caused by you not adding the correct package name or correct SHA1 fingerprint. I followed these steps to blow out the wrong configuration and do it right.
Steps to fix:
Go to your google api console and login: https://code.google.com/apis/console
Click "API Access" tab.
Click the button: "Create another client ID".
Choose: "Installed Application" radio button.
Choose: "Android" radio button.
Enter the package name of the android app that is displaying the above error. You can find it defined at the top of the PlusSampleActivity.java code file. For me it is com.google.android.gms.samples.plus
Acquire your SHA1 fingerprint value:
a. Use the command keytool -list -v -keystore /home/el/.android/debug.keystore. Enter password, If you never set it, the default password is 'android'.
b. The SHA1 fingerprint is shown on screen, copy that.
Paste the above value into the "Signing certificate fingerprint (SHA1):" box.
Click the button: "Create client ID".
Run your android application again, click "Sign in".
Now you are presented with an Activity to "Sign in to Google+ SDK with Google".
In my case, the solution was to actually set an email address in the Consent Screen.
First, I was a bit reluctant to select my personal address and for an strange reason you can save the form without this piece of data with no error. After checking what others have suggested, as soon as I set my email address in that form, it started working.
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
Go to your cloud console
Make a new project i would suggest a name like
oldprojectname-gplus
In APIs section enable Google+ API
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
My solution to the problem was following.
I did everything others recommended and there was no typo regarding the package name and SHA1 key. I also tried removing the key and then adding it again but it didn't help.
What did help is removing the key and creating a new project (at https://code.google.com/apis/console) and then creating the Client ID (with package+sha1) again there. After that (5 secs) everything worked on my Android device.
This problem is related to the permissions from the api console.
if you are using a permission related with SCOPE_PLUS_LOGIN, in the api console you must create two keys, one for OAuth client id, and other for public api key.
In my case the problem was that I changed the package name of the app and didn't update in dev console.
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.
public static final String AUTH_SCOPES[] = {
Scopes.PLUS_LOGIN,
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/developerssite" };
mPlusClient = new PlusClient.Builder(this, this, this)
.setScopes(AUTH_SCOPES)
.build();
Thanks Thano for the solution
"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."
Recreating the project in the Google Console worked for me after several other attempts:
For any reason my project did not have a project ID (old console/new console?).
As Thano (above) suggested, I created a brand new project, created Client IDs, ... and then in worked. Thanks for the advice!!
Remember to use the built-in debug keystore for testing. I had everything else working correctly, but I had set my production keystore SHA1 fingerprint in the Credentials in the Developers Console, which caused it not to work.
If your facing this error when you try to run the sample application "or" copy the project which you have created in other machine which was running successfully in that and giving such pop-up error in the other machine where you are trying to run ,you can follow the below method and it will help.
If your are building the app for testing/debug purpose then,
1.Generate the new SHA1 if you copy your project and run it on other machine for the package name and path provided for keystore.
2.Change the ClientId in developers console for new generated SHA1 and run it in the new machine where you have copied the project and trying to run it.
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:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ntk.darkmoor"
android:versionCode="1"
android:versionName="1.0" >
In this example define "com.ntk.darkmoor" while creating the Client ID
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.
Its working for me when i connect the device and install the apk from Android Studio.
But its now working for me when i generate the .apk and install it from dropbox.
I went through all the answers provided here and others as well. In my case the issue was the SHA-1 as well. The reason I was getting the incorrect SHA-1 was my keytool export cert command.
Previously I was using
C:\Users\mysuername\.android SHA 1 signature keytool -exportcert -alias androiddebugkey -keystore "keystorepath" -list -v
The problem was in the androiddebugkey variable. Here you have to give the name of the key you use for signing the application.
C:\Users\mysuername\.android SHA 1 signature keytool -exportcert -alias mykeyname -keystore "keystorepath" -list -v
Hope this helps someone!
To add to this long list of reasons my problem was that i got the debugkey from the jks file rather than the app.
Its always something small.