Maps V2 key issue - android

My com.me.ProjectA is a working app that uses Google Maps V2. I have both Release and Dubug api keys for this app that I got at the Google API console. The app works perfectly.
I copied projectA renaming it to com.me.ProjectB. I tested ProjectB on my device and everything ran fine except, as expected, the map would not show because I still had the api keys for the old namespace of ProjectA in the manifest file.
So, I went to the Google API console and got a new debug api key for com.me.ProjectB using my SHA1 debug fingerprint (That I can get in Eclipse by hitting Windows->Prefs->Android-> build) and my com.me.ProjectB namespace and put this into my manifest file.
So, I think I am doing everything right but when I run it on the device I get no map and I get the messages in logcat saying...
12-14 16:32:34.389: E/Google Maps Android API(30070): Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
12-14 16:32:34.399: E/Google Maps Android API(30070): Ensure that the following correspond to what is in the API Console: Package Name: com.me.ProjectB, API Key: AIzaSyAk1dcariCofa7b4pboMGVtReWaDwT_yL4, Certificate Fingerprint: 5A608D32E8A0901CCCD2C519010AD73BE5F609A2 (these are not the real values)
And, of course, the namespace, SHA1 fingerprint, and the API key all match.
Did I forget to do something?
Thanks,
Gary

Have you tried to completely remove the application and then install it all over again. As you said you tried to run the project with the key from Project A. This key might be got cached and even if you install the application with the new key, the old one will be used.
So before you install your application with the new key, try to remove the application completely from the phone.
You can as well go over this blog post I wrote and make sure you do all the steps right in producing the key:
Google Maps API V2 Key

Related

google maps doesnt show after upload to google play

I uploaded my app to the google play store, and the map didn't work, just showed white screen. I understand that I have to get a key based on the release certificate fingerprint. I have tried to read all about it, and have done the following, but it still isn't working:
I created a new keystore (with password, and alias and password etc) from Android Studio.
I run the cmd and did this:
keytool -list -v -keystore key.jls -alias MyPlaces
then put in my password, and got all the information that I need. I generated a key for google maps and places api, based on the sha1 fingerprint result that I got. I put in my package name. I put the Alias code back into my app for the key.
But it still doesn't work. I know others have had this problem, but what helped for them hasn't helped me.
Why? I hope its clear what i wrote. Thanks
I am not uploading it each time i check to the play store. Rather i create the signed apk, then try to run it from my phone. DOes this matter?
EDITED:
This is the message I get in the logs.
06-22 23:10:07.529 6500-6543/? E/b: Authentication failed on the server.
06-22 23:10:07.530 6500-6543/? E/Google Maps Android API: Authorization failure. Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
06-22 23:10:07.536 6500-6543/? 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 (;): 38:.......F0;com.....myplaces (I have deleted this for security)
i solved this problem finally after 3 week :D
you upload the googleplay your apk, now you have 2 different " SHA-1 ", They are
"Installation certificate (your old certificate code)" and "Application signing certificate(its the new, from the googleplay")
you need to do so easy, you must add to api console your new SHA-1
First check if you have debug and release app keys. Then you have to link your api to your proyect. Apis and services (google play console). So You have to configure google play services because google maps api uses it.
I know there are diferent keys for debug and released apps. i recomend
API v3 too.
Try this to register your api key.
https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=24:85:5A:C0:F8:0D:36:4C:1A:B9:45:B6:21:92:B0:6E:7D:71:55:08%3Bcom.mapsapi.vatsan.googlemapsapidemo
It can take some minutes. Then you have to set your google_maps_key in
your android app Manifiest.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSDSSDDDAAD...Your API KEY" />
If doesnt work and if you are using android studio, try creating a new
Map Activity(It's V3), complete res/values/google_maps_api.xml with
the key and the map gonna work. How to create google map
I can use googlemaps in my app after upload it to google play store. You have to configure Google Play Services in your google play console.
Consider trying this approach:
First, I see you have done some of the steps as described in the developer documentation.
You should however, add a second key for the debug to the project you created on the developer console.
For some reason, without both, sometimes it fails to show the map when you publish.
I also switched from using v2 to geo when adding to your AndroidManifest file.
Of course you must add the INTERNET PERMISSION and if you are using Gradle dependency manager, add the google-play-services from your sdk.
compile 'com.google.android.gms:play-services-maps:9.0.2'
I hope this helps! Let me know how it goes!
This is the answer.
In my log it showed:
API Key: YOUR_KEY_HERE
Google automatically makes a resource file, googles_maps_api.xml and in there the string reference:
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIza....DOWdQ</string>
When compiled, it wan't identifying this string. I made a string resource in the strings.xml file, and then it worked.

API keys causing issues

In my android app I am using google map and location services.So I generated API key on google developer console for my development work using SHA1 generated by making use of debug.keystore.It worked fine and google map worked perfectly. When I had to release the apk I signed apk following instructions at http://developer.android.com/tools/publishing/app-signing.html#studio.
When I tried to beta test the app, google map didn't work.Visiting the forums told me that I need to generate another google console API key using SHA1 generated by using keysotore which was created while signing the apk.I did same and replaced the key in androidmanifest.xml(So now my project on google console has two API keys,older one I used for development,and newly created one ). But when I regenerated apk and tried to run it on my personal device from android studio, map didn't work.Moreover when I replaced new key by old debug version of key in manifest file and tried to rerun app on my android device map still don't work.So now my older key is also not working while it was working fine before all these changes.
Please help me in this regard.
You should be using the same API Key for your applications but you need to add both the debug and release credentials.
So you will end up with two entries in the android applications:
99:88:77:66:55:44:33:22:11:04:76:99:C3:2A:52:71:7C:64:EC:8B;com.package.app
99:88:77:66:55:44:33:22:11:1C:CC:33:D7:74:A2:49:5D:7D:BF:C6;com.package.app
You can refer to this question for help with the process of adding credentials for each keystore.

Does i need different SHA1 key to perform Google Map

Hj. I am using google map API v2 for project. In my office, it works fine with cert_fingerprint key 1
But when doing it in home, i got a blank google map. Trace log i can see this:
03-17 04:40:44.288 12461-12510/com.dump.dms 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: AIzaSyDEE3COcEWPZte_cpPl*********L2Cm_A
Android Application ( < cert_fingerprint > ;< package_name >): EF:FA:C1:36:BD:FA:D6:6A:DE: ** : ** : ** :53:C8:8B:16:C1:15:C7:ED;com.dump.dms (call cert_fingerprint key 2)
So i must to replace to cert_fingerprint key 2 . Then my app works normally.
Could anyone explain why i need 2 cert_fingerprint key like that? How can i use only one cert_fingerprint key ?
When deploying your app as debug build, the problem is that at home your debug.keystore is different than at work. In your office, you used that debug.keystore to generate the SHA1 key which you used for generating the Google Maps API Key. When you deploy your app at home now, another debug.keystore is used and the key doesn't match.
The easiest way would be to copy your the debug.keystore file from your work environment and use it at home. But you can also enter multiple SHA1 keys in your Google API console like this (for every environment you use which means you need to create SHA1 keys for the debug.keystore files of all your environments):
AB:0A:05:...:12;com.example
CD:35:01:...:2B;com.example
The same problem appears when you deploy as release build (using the keystore file you need to generate when exporting your Android App as APK file)
See also: http://developer.android.com/tools/publishing/app-signing.html#debug-mode

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

Google Maps Android API keystore

In my app, I use maps to show the current position. Then, I use Google Maps Android API v2 (I don’t use Google Maps API) to add this functionality to my app.
When I am developing my app in eclipse everything is OK. I create an Android key with the debug keystore and I use it in the manifest, I can execute my app well and I can move and use the map. In this case I have no log errors (only the typical “The Google Play services resources were not found. Check your project configuration to ensure that the resources are included”).
Now when I upload my app to the Google Play Developer Console, in beta testing it works, but when I go publish, the map gets grey background and doesn’t work. Log gives me this error:
09-23 14:05:46.475: E/Google Maps Android API(5485): Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
09-23 14:05:46.475: E/Google Maps Android API(5485): Ensure that the following correspond to what is in the API Console: Package Name: gc.yy.xxxx, API Key: AIza*******************************RDEI, Certificate Fingerprint: 472D********************************7218 (keystore use to sign the package)
Then I decide to use in my eclipse project that keystore, so I create a new Android key (47:2D:*************************:72:18;gc.yy.xxxx gives me AIza*****************Qm4Q key) and I paste it in the manifest file. I run the project and I get once again the grey background. Log gives me this error:
09-23 14:10:45.307: E/Google Maps Android API(5585): Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
09-23 14:10:45.317: E/Google Maps Android API(5585): Ensure that the following correspond to what is in the API Console: Package Name: gc.yy.xxxx, API Key: AIza*******************************Qm4Q, Certificate Fingerprint: CC4B********************************A917 (debug keystore)
I don’t know if the problems concerns to the keystore. I use debug.keystore with my map (I can’t use another one, I don’t know if it’s not possible) and I use a keystore I create to sign my app package. It seems an infinite loop of no useful API keys…
Thanks in advance!
EDIT: I finally solved it by adding the 2 meta-data blocks of each API key, that is to say, my manifest was like this:
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIza*******************************RDEI" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIza*******************************Qm4Q" />
And finally, I have my app in Google Play! :)
You need to register your non-debug keystore to the google maps API via the Google API console
I used two different api keys (one for development, one for the release). At the end: that's stupid, since you can have several app hashes attached to one key. Hence that's the solution, just added on code.google.com/apis/console the release hash to the development api key (for backwards compatibility) and the development hash to the release api key (for easier development).

Categories

Resources