I have created a demo from here : https://github.com/suchoX/PlacePicker
Done same as explained over there.
Added Api key also in my Manifest file as below inside application tag:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="secret_api_key_not_shown"/>
Getting below error :
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.
12-05 16:22:30.108 10392-10522/com.mypackage 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.
You need to enable the "Maps SDK for Android" API from the Developer Console.
Related
I am trying to get Google Maps working on my Android project.
I did everything by the book but nothing works...
Google Maps Android API: Authorization failure.
Cannot resolve Identity from identityId. Dispatching as
Identities.PSEUDONYMOUS.
Ensure that the "Google Maps Android
API v2" is enabled. Ensure that the following Android Key
exists:
API Key: Android Application (<cert_fingerprint>;<package_name>):
GoogleCertificatesRslt: Package signed with unknown certificate*
The API key, fingerprint and package name are correct.
Restricting and unrestricting the API key makes no difference.
Switchen between debug and release fingerprint makes no difference either.
It simply doesn't work whatever I am trying.
Any suggestions what I am missing, doing wrong or lousy documented?
The problem was located in local.properties:
Instead of MAPS_API_KEY="AbCdEfGhi1234..." it should read MAPS_API_KEY=AbCdEfGhi1234...
Don't surround the key with ""...
Now, when you register an api key on api console for using Maps V2 on Android, you can configure it to work without restrictions, and I want to do it because I want to make some tests with the same key in various apps, and it's mandatory for me to achieve this.
I configured the key this way:
But when I'm trying to use it without restrictions active on the api key configuration, in debug mode it works perfectly but after signing my app with my keystore the tiles on the map are not being displayed and I'm getting this error on the logcat:
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.
03-02 16:49:12.158 2600-2660/? 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>):
What more it's necessary to do to get a key working without restrictions in various apps without indicating theirs packages and sha's ?
PD: I don't know why API Key has a "YOUR_KEY_HERE" value on the log because it's correctly specified on the xml file and I can see it on the manifest.
Finally the solution was very simple, but frustrating. In Android studio you can see this file for editing:
app > src > debug > res > values > google_maps_api.xml
And it's the debug placeholder for the key... you must also write your key here manually:
app > src > relese > res > values > google_maps_api.xml
Worked like a charm.
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyCxVL4qigDepaIfT9ZZMfT4eZr_PPri04s
</string>
Here's the log cat:
12-23 12:11:31.091 15026-15026/? E/SELinux: [DEBUG] seapp_context_lookup: seinfoCategory = default
12-23 12:11:31.101 15026-15026/? E/SELinux: [DEBUG] seapp_context_lookup: seinfoCategory = default
12-23 12:11:31.561 15026-15062/com.example.hamees.hf_mainuserinterface E/GMPM: getGoogleAppId failed with status: 10
12-23 12:11:31.561 15026-15062/com.example.hamees.hf_mainuserinterface E/GMPM: Uploading is not possible. App measurement disabled
12-23 12:11:57.831 15026-15592/com.example.hamees.hf_mainuserinterface E/b: Authentication failed on the server.
12-23 12:11:57.831 15026-15592/com.example.hamees.hf_mainuserinterface 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.
12-23 12:11:57.831 15026-15592/com.example.hamees.hf_mainuserinterface 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: AIzaSyCxVL4qigDepaIfT9ZZMfT4eZr_PPri04s
Android Application (<cert_fingerprint>;<package_name>): 44:56:1D:16:8F:1E:A8:6C:C3:1C:03:FC:8F:DA:2A:08:1C:48:E0:2D;com.example.hamees.hf_mainuserinterface
The logcat is giving you the EXACT reason of the loading fail:
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: AIzaSyCxVL4qigDepaIfT9ZZMfT4eZr_PPri04s
Android Application (<cert_fingerprint>;<package_name>): 44:56:1D:16:8F:1E:A8:6C:C3:1C:03:FC:8F:DA:2A:08:1C:48:E0:2D;com.example.hamees.hf_mainuserinterface
The Api key you provided is not valid. Ensure that:
Your key is activated, from the google server it can take up to several minuts
You provide the good fingerprint SHA1 (one is for release, one for debug: SHA-1 fingerprint of keystore certificate)
Your app has the permissions and everything is set to use the google map API: https://developers.google.com/maps/documentation/android-api/start?hl=en)
There are many questions similar to mine. i went over them all (i hope). Also i think i'm doing everything OK. Maps v2 worked until last update of Google Services to Rev 25
I'm getting:
E/Google Maps Android API﹕ Authorization failure
Ensure that the "Google Maps Android API v2" is enabled.
Ensure that the following Android Key exists:
API Key: AIzaSyB...
Key matches. next:
Android Application (<cert_fingerprint>;<package_name>): 87:60:41:37...;com.example.example
Certificate match
So everything matches but i still getting Authorization failure
AndroidManifest
<meta-data
android:name="com.google.android.gms.version"
android:value="7571000" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
gradle-app:
dependencies {
compile 'com.google.android.gms:play-services-location:7.5.0'
compile 'com.google.android.gms:play-services-maps:7.5.0'
compile 'com.google.android.gms:play-services-gcm:7.5.0'
}
Also i recompiled and re-installed the app multiple times
Delete older key and generate new key. Hope it helps!!
The answer is only based on comment.
I created a small Android Map project and everything went fine until I move with my workspace to another computer.
The google map is not visible and the logcat output has the following line:
07-24 16:15:24.261: E/Google Maps Android API(21868): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors)
My first thought was the missing/wrong keystore because I forgot to copy it from one computer to the other, so I took the SHA1 fingerprint from my new debug.keystore (C:\Users\Enrico.android) and created a new Api key with this fingerprint and put it to Manifest.xml.
No result.
My second action was to renew the google-play-services_lib but it changed nothing.
Here some interesting parts of my code and from the Api console:
SHA1:
C1:07:A9:8B:E0:B1:FF:49:B4:C3:C6:E8:3B:98:93:FF:8F:D6:36:2F
Api console:
API key:
AIzaSyDaDJBQyg7I8_Bd3IrKChEdcNo2E7cxU6g
Android apps:
C1:07:A9:8B:E0:B1:FF:49:B4:C3:C6:E8:3B:98:93:FF:8F:D6:36:2F;com.name.appname
Manifest.xml:
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDaDJBQyg7I8_Bd3IrKChEdcNo2E7cxU6g"/>
<uses-library android:name="com.google.android.maps" />
Please help me!!!
EDIT:
Another hint. When I first started my App on the new computer, I needed to remove my "old" version from my testphone with the hint, that the signature has changed. So in fact it can only be the wrong SHA1 fingerprint in the debug.keystore file...or?
After you have updated SHA-1 on the API Console, you may need to uninstall and install again the app.
Seems like Google Play Services is keeping "unauthorized" answer from the server in cache.
Edit:
You can try creating another API key without specifying SHA and package name. This will create a key that says "Android apps: Any app allowed". I'm a bit concerned about such possibility, because that key could be used by anyone in their apps, but for development it is not an issue.
You might have forgotten to add add the permission "MAPS_RECEIVE"
Define this permission:
<permission
android:name="com.jonasdevlieghere.alma.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
and add it to the list of necessary permissions:
<uses-permission android:name="com.jonasdevlieghere.alma.permission.MAPS_RECEIVE" />
Feel free to change the permission name to match your own application.