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.
Related
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
Got a released app which is using the Google DriveApi (not REST) and it has been working fine for many years.
Started development on next release where I want to use REST. During development I wanted the app to use both APIs. (Eventually I will probably stop using the DriveApi and only use REST.) Implemented first feature using REST. Works fine listing some Google Drive folders using my main Google account.
However, some serious problem occur when I try to use the original DriveApi (not REST): com.google.android.gms.common.api.ApiException: 17: Error resolution was canceled by the user, original error message: INTERNAL_ERROR: null
There's no problem to log-in, but the problem occurs e.g. for a simple function getting the Goggle Drive root folder, and I use the proper scope for non-REST: Drive.SCOPE_FILE
If I re-install the released version from app-store (which does not use REST and never has), I get the same problem! I have a couple of devices which have the app-store version (not re-installed), and the app work fine on these using my main Google account!
Then I created a new Google account, and everything works fine when using this account. I can re-install from app-store and all works just fine.
So the problem occurs when I re-install the app and use my main Google account. Seems like my main Google account somehow got corrupted when I was using REST. But not for the devices where I have not re-installed the app!
I can see these in log just before my app gets exception, but I can see similar logs when all works fine:
2018-11-10 07:56:11.381 1152-1792/? W/AppOps: Bad call: specified package com.google.android.gms under uid 10190 but it is really 10020
Any ideas?
Strange...
After using REST successfully, and getting the ApiException: 17: Error resolution was canceled by the user, original error message: INTERNAL_ERROR: null
when using the Drive API (not REST), do this:
Open https://myaccount.google.com/
Remove the app's access to your account.
Uninstall the app on your device.
Re-install the app on your device.
When you then use the Drive API (not REST) it works fine!.
Try the Drive REST API and you get:
ApiException: 17: Error resolution was canceled by the user, original error message: INTERNAL_ERROR: null
One can note that the old (more or less deprecated) API GoogleApiClient works fina all the time...
Hmm...
Not sure this will help, but for me, I was getting this error with an Android app + the Awareness APIs. I realized I needed an API Key for the Awareness API features (Snapshot and Fence) to work. After I added that, the error went away.
I assume some of the other Google APIs may need that as well in your manifest.
Note: The link is for the awareness API, you would need to check the API guide for other specific APIs.
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.
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.
I'm trying to implement Google Play Services following Google's documentation and I'm seeing the following when I try to connect my GameClient:
E/Volley: [4953] il.a: Unexpected response code 401 for https://www.googleapis.com/games/v1/players/me
E/Volley: [4953] il.a: Unexpected response code 401 for https://www.googleapis.com/games/v1/players/me
E/SignInIntentService: There is no linked app associated with this client ID.
I've checked that the SHA1 fingerprint of the certificate signing the APK, the SHA1 of the debug certificate, and the SHA1 given to the Google API do match up and they do. I've checked that the app id is declared in the manifest in the application item (I've taken in my case the 13 digit numerical id, not one that also includes a package). I've also checked that the test accounts I'm using are each listed in the Developer Console and they are; they're each #gmail.com too, and they include my developer address. They've each activated Google Plus.
I've tried this from an API 16 S3 device and an API 17 Google API simulator. The app's package name is correctly declared in the manifest, on the developer console and matches the API package name. The app is listed as a client of the game service, and is shown as 'ready for testing'.
In short I'm struggling to see what my mistake can be and what I've missed. I think I have everything from Google's troubleshooting addressed too. I've looked at the main questions here on StackOverflow, and they're covered. Whatever it is I'm missing is probably staring me full in the face. What can I be missing?
I got stuck on this problem for a long time until I realised that I had two strings in my app called "app_id". One from the Facebook SDK and one from Google. I renamed the Google app_id (and changed the corresponding manifest reference) and all was well.
It is POSSIBLE that you have a similar problem. If you can't see the error then I would try to write out the app_id to syslog to confirm that this is not the cause of the problem.
Incidentally, all my Google app_id s (client ids) are 12 bytes not 13, so perhaps you should start by checking that.
Good Luck !
Even after redoing everything, everything, I still encountered the same problem. However, I subsequently encountered a "This package is already in use" error message on Google API even though I had undeleted all projects and removed all clients before deleting these again.
This turned out to be a blessing: The solution to this was to recreate my debug key before adding the new fingerprint to Google API in another new client id.
And lo... my original problem went away.
I hade the same problem and for me it worked to re-link the app in Game services -> Linked apps -> Link another app.
You didn't explicitly state that the gmail accounts you're testing with are added as Google Plus users in a Google Plus community that is configured as the testing community for your app -OR- that you're using a google group as the testing community and those gmail accounts are part of that community.
If you have done those things, then it might be the issue stated here:
https://code.google.com/p/google-plus-platform/issues/detail?id=554
This answer might sound encouraging to solve your problem, but don't get your hopes up. I've done all that the original poster did, plus the things above, and I'm still stuck.
I've even followed all of the tips stated here:
Google Play Game Services - unable to sign in
And it would appear the depths of the chasm that Google lets you fall into regarding GPS is far deeper than the depths I've plumbed. Joy.
I had the same problem ,I am not sure that the following action is the one that resolved the problem but its worth the try,
Seems that I didnt had the Drive API enabled ,I had it in the enabled apis but i had to actually click the gear icon next to it and then click enable and provide the application name.
Just link the same package as many times as you have Client ID's in your Developer Console "Debug & Release Client ID's"
The thing is if you link your app to the Game Services with the wrong SHA1 fingerprint, Games Services will pick it up and associate it as the main Client ID.
Once you link the same app again to your Game Services, it will automatically pick up the other Client ID's
I had exactly the same problem, and in my case, I fixed it regenerating the API Key from the Google APIs Console. Go to Credentials, select your API key and then click on "Regenerate Key". You don't need to update anything in your code or link more apps, just regenerate and it starts working magically.