Google Map Android API v2: Authorization Failure - android

I am trying to get my Google Maps to display on my app, but it is not working and this error appears:
01-25 11:38:54.763: E/Google Maps Android API(30514): Authorization failure.
I am currently using the SHA1 certificate fingerprint from the release certificate that was used to publish my app on the appstore.
Edit: I have also switched on the Google Map Android API v2 on the API Console.
I've read from the comments from here that "Signature Algorithm MUST be SHA1withRSA and NOT SHA256withRSA". However, I created the release certificate from Eclipse and it is SHA256withRSA, and I didn't do any settings to it. I can't seem to change it either.
Can someone enlighten me if the signature algorithm is causing the problem? If so, how should I be changing the signature algorithm on eclipse?

Figured out my problem.
I've been generating keys from my release certificate, which WILL NOT WORK during debugging when I run the app on my phone. I have to use the debugging keystore certificate fingerprint instead.
Please remember to keep 2 keys:
Debug API key from your debugging keystore when you run it on your phone.
Release cert API key to be used when you want to sign the app just before deployment to Google Play Store.

Please check that you have enabled the Google Maps Android API v2 in your google api console.

Check your API Key exists or not with the appropriate SHA, if not regenerate it with the appropriate SHA. If you don't know how to generate it, try it below:
JAVA_HOME\bin > keytool -list -v -alias androiddebugkey -keystore "~\.android\debug.keystore" -storepass password(your_own) -keypass "password(your_own)"
Check manifest file, if you written two meta tags like this
<!--<meta-data-->
<!--android:name="com.google.android.maps.v2.API_KEY"-->
<!--android:value="AIzaSyBHghWPWutTiOxCJKll2WoCuVOQ5YotLiY" />-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key"/>
Comment any one among them, for my Project used geo.API_Key, it will handle both GEO and Google Maps.
More importantly import google-services.json file in to your app folder.

Related

Using Google Play Services on different computers (VCS)

I'm programming an android app an added Google Play Services for Google Sign-In support. Therefore I generated and downloaded my configuration file from Google's developer console. I integrated the file into the app folder and everything works fine while sign in with google in my app so far.
Now I wanted to share my Project with another colaborator, but when she pulled the code from GitHub, she cannot sign in successfully. When she tries to sign-in the GoogleSignInResult-object has the following status: Status{statusCode=DEVELOPER_ERROR, resolution=null}. As I looked up in the internet it is probably an issue with the configuration file and the correspondig SHA1-key, but I didn't find a solution.
Does anybody know how to solve thies issue?
DEVELOPER_ERROR
The developer has configured something incorrectly with their
application. This is a hard error, since retrying will not fix this.
Maybe the issue is Google Play services was unable to find a matching client from the console based on the SHA1 and package name.
You can follow this guidelines on how to troubleshoot the problem about SHA1.
The certificate with which you are signing your game should match the certificate fingerprint associated to your client ID. To verify this, first check your certificate's SHA1 fingerprint:
Find your certificate file and obtain its SHA1 fingerprint. To obtain the SHA1 fingerprint, run this command:
keytool -exportcert -alias your-key-name -keystore /path/to/your/keystore/file -list -v
Take note of the sequence of hexadecimal digits labeled SHA1: in the output. That is your certificate's fingerprint.
Note: If you are using a debug certificate, replace your-key-name with
androiddebugkey in the command above. If using a release certificate,
use the name you chose for your key when creating the certificate.
For more information and the next step, just check the link in the guidelines above.
Also check this SO question, it might help you also to solve your problem.

google maps doesn't appear ? android

I've create key for android application , and set the debug sha1 from key store debug which android studio should use.
I extract the sha1 using this command :
keytool -list -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android
I double check that I set correctly the key and the package name at the google developer. and also delete the key and generate another one, but that doesn't help, google maps deosn't appear.
please notice that my production app work perfect.
What may be the problem ?
EDIT:
logcat show this:
Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
SOLVED:
I forget to enable the map api at the google project console, the log cat doesn't doesn't show this problem.
When I had this issue, it was because the package name I entered in the developer console to get the key was different from the package name of my application. Please ensure that they are the same

Google Maps V2 not working in production with correct key

I'm having major troubles getting Google Maps working in production within an Android app. This is what I am currently getting (the bottom is just ads).
Key Steps I have followed:
1) I have ensured I have got the correct SHA1 Production Key and have implemented it on the Google Console API as well as within the app (They key that google gives). I have registered two keys - one for the debug and one for production
2) Internet, location, etc is working
3) The app works in DEBUG mode, but does not work when signed and installed on device via USB. I have triple checked the SHA 1 signature of the sign, etc.
4) The MapsFragment comes from the template available in Android Studio.
In production mode, the log cat displays this:
01-11 16:04:54.511 19346-19437/com.mike.mapstest E/Google Maps Android API﹕ Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
01-11 16:04:54.516 19346-19437/com.mike.mapstest E/Google Maps Android API﹕ In the Google Developer Console (https://console.developers.google.com)
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: YOUR_KEY_HERE
Android Application (<cert_fingerprint>;<package_name>): <SHA1 Removed for this> ;com.mike.mapstest
This error obviously says something is wrong with my auth?
What am I doing wrong?
Based on the logcat output from your debuggable release build:
01-11 16:04:54.511 19346-19437/com.mike.mapstest E/Google Maps Android API﹕ Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
01-11 16:04:54.516 19346-19437/com.mike.mapstest E/Google Maps Android API﹕ In the Google Developer Console (https://console.developers.google.com)
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: YOUR_KEY_HERE
Android Application (<cert_fingerprint>;<package_name>): <SHA1 Removed for this> ;com.mike.mapstest
it would appear that you have not overridden the api key placeholder YOUR_KEY_HERE in the manifest (or separate api keys file, depending on your configuration). Replace that string, wherever it lives, with your actual key and you should be good to go.
Edit: this tutorial, if it matches your configuration, probably explains why you are only seeing this for release builds:
Return to Android Studio and paste the API key into the YOUR_KEY_HERE section of the file:
Note that these steps have enabled Google Maps support for the debug version of the application package. The API key will also need to be added to the google_maps_api.xml file located in MapDemo -> app -> src -> release -> res -> values when the release version of the application is ready to be built.
I was having these same issues, and was banging my head against the wall for a few days. I read all the posts about putting the correct key in place. I kept putting the correct key in my google_maps_api.xml file. StKent above mentioned to make sure to overwrite with the actual string in AndroidManifest.xml. This is what fixed it for me.
What I had when it didn't work:
in AndroidManifest.xml:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
and in google_maps_api.xml:
<string name="google_maps_key"
templateMergeStrategy="preserve"
translatable="false">AIza_the actual key</string>
What I changed to for it to work
I changed my AndroidManifest.xml to include:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzsa_the actual key" />
When using Android Studio to generate the Google Maps Activity, it will ignore your gradle build configs and use the default debug.keystore. The SHA1 in google_maps_api.xml is based off of this default. When creating permission in the Google API console, make sure to use your production and debug SHA1 if you are using the non default.
debug and production key will be different . If you use debug key for release mode ,you can not view the google map. For release mode , when you change google map key , you should clean the project then export apk.
you can get more information
https://developers.google.com/maps/documentation/android/start
to get private SHA1 from debug key store
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass your_app_password
to see more
SHA-1 fingerprint of keystore certificate
or you can you eclipse tool to generate private SHA1 key using export menu
In my case, I had entered the wrong package name in Google API's API Manager - Credentials - "Restrict usage to your Android apps". Make sure you enter the correct package name (as in AndroidManifest.xml) and the correct SHA fingerprints (for debug and production).
Solved, I put on the Manifest the "Key for browser apps (with referers)" instead of the "Key for Android apps (with certificates)" from the Google API Console
In my case, the gray screen was caused by having a custom implementation of HostnameVerifier that was preventing the tiles from being loaded.
Hope this will help someone else in the future.
error //Ensure that the "Google Maps Android API v2" is enabled.
In this u can't find like Google Maps Android API v2 in Google Cloud Platform Console.in this, give the exact Package Name: and signature of your project which is showing in run window or debug window , I faced the same problem because of changing MapActivity package location
I struggled to find this whole day so make sure whether u changed any packages inside project if so give package which is showing in error text
emphasized text
Ensure that the following Android Key exists:
API Key: YOUR_KEY_HERE
Android Application (;): ;com.mike.mapstest

Map is not working after installing from play store in android

I'm stuck in this issue, when i run my project in eclipse it shows map correct, but when i upload it to Google play store and when i install it in my device , it shows the blank map,
I don't know what is a problem my map key is correct, package name is correct, i also generate new map key and try, but it also doesn't work. I don't know where is the issue.
Please follow the check-list :
1) Sign the app with new .keystore.
2) SHA1 of new .keystore should be used.
3) Map key should be made using this SHA1.
4) If new Google account is used, then make sure Android Maps V2 services is turned on for that account.
As this type of issue was already raised and there was the solutions
Google Map Android API v2 can't display map in play store application
This problem is because of map api key.
You need to sign your app and find keystore for signed app.
Right click on project
Android Tools->Export Signed application pachage->next -> create new keystore
then use this new keysore to find new SHA1
Now find new API key for your app.
And replace the old map API key with this in manifest.
Next time whenever you want new signed app just use this keystore no need to create new again.
Make sure you update the SHA-1 in the play store from the location
Select your App --> App Integrity --> App signing key certificate --> SHA-1 certificate fingerprint.
Paste it into Release Key along with the app package name.
You need to do the following things to get your Maps Visible for both Debug Mode and release mode
-1 Add debug key to package combination at Google API console
-2 Add release key to page combination at Google API Console
Note : you need to add at lease 2 combination to get your maps visible when you are testing and when you generate *.apk file.
What you are missing right now is not adding the release key to application package combination to API console add this and after that do the following:
replace your debug map key with release key and generate your *.apk and install aplication to your device you will get your maps
there are several Tutorial available on net i would to suggest you the following one
Google Maps
To Generate the Release key do the following steps
Open CMD (in Windows) terminal (in Linux?MAC os) find the path to your jdk dir and then to bin like following:
C:\path-to-jdk\jdk1.7.0_07\bin>keytool -v -list -alias tt -keystore path-to-keystore -storepass password -keypass passowrd
for me the path is following for Jdk/bin and that for key store
C:\Program Files\Java\jdk1.7.0_07\bin>keytool -v -list -alias tt -keystore D:\ke
yStore -storepass password -keypass password
you need to give the following things of your own
-1 path to jdk
-2 path to keystore
-3 keystore passoword
-4 keypass password
Also look http://android-er.blogspot.in/2012/12/displaying-sha1-certificate-fingerprint.html for more information

Android Google Maps API v2: Authorization failure at different laptops

I've followed the steps here and here to create a MapView in our teams project which we sync with svn. After following the steps, MapView was running smooth, but only on my laptop. My project members are always getting
02-06 13:27:37.327: E/Google Maps Android API(19490): Authorization failure.
when opening the MapView. So I deleted the old one and generated a new SHA1 fingerprint for a new Google API Key on another laptop with my Google Account with:
keytool -list -alias androiddebugkey -keystore ~/.android/debug.keystore -storepass android -keypass android -v
So now it's working on the other laptop where I generated the SHA1 fingerprint but when I try to run the project on my laptop I'm now getting the
02-06 13:29:51.280: E/Google Maps Android API(20262): Authorization failure.
Error.
We are not using proguard-project.txt, we tried different devices where google-play-services is installed and included /extras/google/google_play_services/libproject/google-play-services_lib as a library. We also tried to generate multiple API Keys but only one was working.
What are we doing wrong? Do we have to use different Google Accounts to create individual keys?
Quoting the Google API Console:
API requests are sent directly to Google from your clients' Android
devices. Google verifies that each request originates from an Android
application that matches one of the certificate SHA1 fingerprints and
package names listed below. You can discover the SHA1 fingerprint of
your developer certificate using the following command[...]
One SHA1 certificate fingerprint and package name (separated by a semicolon)
per line.
Highlight here on one per line.
`
For each laptop where you build your app you have to generate an SHA1 fingerprint and add it in the API Console.
You have two options here.
Add a separate line to the api key for each device you have.
Extract the api key to a file (eg. map_key.xml) and reference this file from the AndroidManifest.xml.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/google_maps_api_key_v2" />
Add this file to your .gitignore - so now each project member can override with its own key.

Categories

Resources