Google Maps API isn't loading map - android

I've been trying to get Google Maps working for hours, but all I get is a gray screen. No map at all. I know similar questions have been asked here and I read all of them without getting any further.
A few hours ago I managed to get the Maps working when running the app from my computer, but when installing the APK, it didn't work. So I noticed that there are different API keys for debugging and the release. I decided to start all over again, with generating new keys and so on. So I removed my existing keys from Google, generated new google_maps_api.xml files and followed the instructions.
But now, when running the app from my phone I am getting the following error message:
E/b: Authentication failed on the server.
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.
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: (OLD_API_KEY)
Android Application (<cert_fingerprint>;<package_name>): (MY_FINGERPRINT);(PACKAGE_NAME)
So, first of all, how do I ensure that "Google Maps Android API v2" is enabled? On the Google API website I can only find a Google Maps Android API that I enabled. I can't find anything about v2.
And, how can I "Ensure that the following Android Key exists". I removed the OLD_API_KEY because I wanted to start from the beginning. No idea where it is coming from now. I obviously don't have it. So I can't ensure it is there. Why can't I just use a new one that I generated? And why does it even know my old key, that I already removed?
If I understand everything correctly, I am supposed to generate one API key for debugging and add it to my google_maps_api.xml in the debug folder. And for the release I generate another key and add it to the google_maps_api.xml in the release folder. Do I also need to add an API key to my AndroidManifest.xml? At the moment I have this between my application tags:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key"/>
Where #string/google_maps_key is my debugging key.
My main problem is, why I need to ensure that an old api key exists, that I already deleted. How can I tell Android that I want to use a different one?

I got it working! It turns out that it took a long time until the API keys are actually available to the app. A lot longer than those 5 minutes mentioned on the API page.
So, when you an API key and get the same error message as me, it is probably best to just have a small break and check again in like 20 minutes until the API key is available.

Related

Google Api Authentication failed while setting google map api

I was using google map API in my app was working fine but yesterday when I added some other feature in the app and started testing it suddenly Map API is no longer working so I thought there may be some issue with the code so I checked and found that I have not changed anything in the map API but when I try to create another app in the Google API came to know that limit is crossed and not even able to see what are the current project I have as the limit is 30 as it says but, in reality, I have used mostly 4-6 app using the API . I looked into other similar questions and tried the same thing but no solution so far. Any solution that may help me will be helpful
I am getting this error while running
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
the key is there and As i said it was the same app which was working earlier.
Following steps might help:-
1. Login to google devloper console.
2. Select your project
3. Select "Library".
4. Check Maps API if it is enabled or not.
1 => https://console.developers.google.com/apis/credentials
2 => create credentials
3 => Api key
4 => Restrick Key
5 => Application restrictions -> Android apps and API restrictions -> Don't restrict key
6 => Save then wait for 5 min then use generated api key

403 error when trying to access Google Drive API in Android app

I'm trying to access the Google Drive API in my app using the guide at REST API Quickstart, however when I run the app I get a 403 forbidden error message that tells me that the Drive API is not enabled for my project.
I don't understand why this is or how to fix it. The Drive API is definitely enabled in the Google Developer's Console and is set up as with OAuth 2.0 credentials, along with any other API's that I thought might be related. The full error screen grab is shown in the link:
If you used a different package name than the one in the example, then you might have forgotten to change it in the codes...like make sure you have the package name correctly set in the build.module, manifest...it happens when you just copy and paste stuff...
Check google developers console make sure drive SDK and drive API are enabled.
They both need to be enabled for some of the requests.

API Key failure when running Google Map app on Android Phone

I am trying to create a map app with the GOOGLE API, for use on android devices, but I'm fairly new to this so have been following tutorials to get me started. I fixed my initial problem, however another one has appeared and I can't find what's wrong / how to change it!
When running the app through a mobile, it loads onto the phone fine, a screen loads (the sort of beige colour you see when google maps is loading) as well as the logo and zoom controls. But stops after this and displays the following error in LogCat:
Authorization Failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
Ensure that the following correspond to what is in the API Console: Package Name: com.example.myapp, API Key: [my api key], Certificate Fingerprint [my code]
Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
I have completed the steps on the link and checked my code and made sure all those details match, but it's still not working.
This is probably a very basic error, but how would I go about resolving this / Am I looking in the correct place?
[Code no longer here; had to delete it]
If you run the app through Eclipse with a USB connected device, you need to use the MAPs debug key. If you export the app and load the .apk on a device, that app would have to be compiled with the production key.
Last resort: uninstall and re-install app. Clean and rebuild the project is also a good idea
Moreover, please make sure your API key was an Android key, not a browser or server key. Also check that the service is Google Maps API for Android V2, not Google Maps JavaScript API V2.
If you still get any problems, check your set-up against the top answer in this question: Google Maps API V2 - always get authentication error.

Google Maps Android API Authorization Failure when reusing api access key in android

I created one application and generated an api key, which worked and my app correctly renders map.
I created a second application, which is based on an Android Library project I created and I want to reuse the API_KEY of the first app. In https://code.google.com/apis/console, for my API debug project, I selected "Edit allowed Android apps...".
Then on a new line, I added the SHA1 certificate fingerprint and package name (separated by a semicolon) of my second project. So now that API Access key has the fingerprints of two apps associated with it.
However, when I test the second app on my android phone, logcat outputs
Google Maps Android API Authorization Failure.
The Certificate fingerprint of my second app is correct. My second app also references Google Play Services and is using Google API Level 16.
The second app manifest file is set up similarly to the first one, making reference to the debug API_KEY and having the same android permissions. What may I be doing wrong?
However, the recommended practice is to sign each of your applications with a different certificate and get a different key for each one.
https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2
:D
I've previously found this helpful https://stackoverflow.com/a/13865113/935779
Make sure to export a signed copy with the same key you used to create your API key
This is often a problem when working with a Google Maps key and may very well be your issue. However, Nathvi is also correct from the documentation and you may consider a separate key if at all possible.

Where should I put apiKey before publishing android application in Android market

I have signed and get this kind of code:
<com.google.android.maps.MapView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0vzxVMvckBdI64O0FdGSRXawhfAlw"
/>
Then I put it to main.xml, under the . I run the project, it force close. The error is that XML can not find MapView. But I have add the library below. Moreover, I have test with google API Vitual machine, and it does not work too. Then I add Internet permission, and add:
<uses-library android:name="com.google.android.maps" />
under the in manifest, but it still does not work.
Could anybody tell me clearly step by step what I have to do, I am in a mess now and I can understand want to do next.
Before signed the apiKey, my application run well. Anybody help me.
Thanks in advance.
If you app worked well before signing your app then its the problem of you map Api key.
You can get a temporary Maps API Key based on your debug certificate, but before you publish your application, you must register for a new Key based on your release certificate and update references in your MapViews accordingly.
use adb to install the apk on your device/emulator (adb install app.apk). Don't forget to uninstall the debug version first, otherwise the signature difference will prevent the installation
EDIT:
When using GoogleMaps for Android, you need two keys - debug and release.
The "debug" key is kind of a misleading term. This key is also to be used when you develop the app in Eclipse. So essentially, use the debug key for development, testing, debugging.
When you're ready to launch the app to Market, set the android:debuggable="false" in the AndroidManifest.xml and use the Signed API key.
When using the signed API key, the MapView will show up ONLY when the app is installed from the Android Market. So, installing the app from Eclipse (Run As, Debug As, etc) or command line (adb install) won't show the MapView. Rest assured, once the app is in the Market - you download it and the MapView will show up.
With the signed API key, if you deploy the app from Eclise, you will get a "Server returned 3, IOProcessing Exception 26" as a warning - just ignore it.
Note: Also ensure there are no duplicate instances of the same MapView. If your app needs "x" no. of MapViews, generate "x" no. of new signed keys (one for each MapView) since GoogleMaps has a query limit for a single MapView instance.
For getting both the keys, follow the steps for Obtaining API keys for GoogleMaps on Android.

Categories

Resources