Getting Error in Display Google Maps in android - android

I am developing an google Map application
For My Code Please See Following Link.
Link For Code
I had run that application completely and that was worked.
But I changed Package and Changed API key which I had mentioned in menifest File.
For that:
I had reffered Lots of link for that and also clean the project.
Uninstall the application from deveice with its data completely and again run with different key.
But result is same.
In that I got Following Errors:
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.rchat, API Key: AIzaSyCvFmp6pNM6LHn4AEuWvztuePsIQNLPtZo, Certificate Fingerprint: E2C6F24150FD2483E06F709DF128962CEF35A63E
Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
please help me for that. The mapview is displaying with white background but map doesnt displaying.
Thankyou in advance.

Step 1: Eclipse -> Window -> Preferences -> Android -> Build
copy SHA1 fingerprint:
Step 2: register google account and go to https://code.google.com/apis/console/
click on "Create New Android key"
paste your sha1 and package name your's project
Step 3:
.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="<your_package_name>.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Required to show current location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<!-- Goolge Maps API Key -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="<your_api_key>" />
</application>
Note: delete old app on android device , and run again. hope this help for you.

Include the following code to your manifest file.
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"
/>

Something may wrong in your Manifest.xml. After changing the package name, did you change permission package name?
<permission
android:name="com.example.rchat.maps.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.rchat.maps.permission.MAPS_RECEIVE" />

Related

Maps are not displayed when the application is published in the store

I am working with Google Maps only that I am having a problem when viewing the map in the application, I already generated the launch certificate and I provide my fingerprint, I generated the signed Apk to upload it to the store, nothing more that when published in the store the maps are no longer displayed but I test the other devices by passing the Apk file and it works wonders, I feel dismayed by the problem I am having, I need help in this.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<permission
android:name="ixzihua.com.mx.ixzihua.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="ixzihua.com.mx.ixzihua.permission.MAPS_RECEIVE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Step by Step
find your keystore (*.jks file) (you needed to generate this in order to publish anyway)
execute something like this in command prompt (Windows) "C:\Program Files\Java... whatever java version you have ...\jre\bin\keytool.exe" -list -v -keystore myappkeystore.jks
You'll see a bunch of info including your release APK's SHA1 if done right.
Go here: https://code.google.com/apis/console
Opt out of the new interface (its horrible) and use the old interface if possible
In old interface go to services and make sure Google Maps is enabled
Now go to API Access and update your old SHA1 with the new one by click "Edit Allowed Android Apps" to the right and overwrite the old one with the new one. Click Update. Done.

Google map not loading Android

Though I know this has been a persistent and addressed issue, everyone's problem seems to be solved a different way every time. I have been trying to get my map to show all day but to no avail. I had a project which had a map in it, so what I migrated that project to another location and set up Google Play Services in that project. I got everything to work except for the map to show. I have the library as i am able to use LatLng but the map always fails to load. I have generated new keys, deleted and re added the key, and deleted and re added the debug keystore. I have also updated the api console to ensure everything lined up but my map still doesnt show. I have Google Map for Android Api enabled in the console. And my package name is correct also. I have ran a clean rebuild and uninstalled the app to see if it works but it still doesnt load.
NOTE: I have also tried using SupportMapFragment instead.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.wallfly"
android:largeHeap="true">
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Actionbarstyle">
<activity
android:name="com.android.wallfly.MyActivity"
android:label="#string/app_name" >
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="(Actual API Key)" />
</application>
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<permission
android:name="com.android.wallfly.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.android.wallfly.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<!-- these grant the app the ability to access location. coarse is wifi and cellular, fine is gps -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
I have added an image to show that my package name lines up. Also i copied and pasted the SHA1 fingerprint so I am sure that it does line up also.
For those who may face a similar problem, my google play service was outdated. So I had to change the build.gradle the current version of google play service.

Google Maps Android API v2 - I can't run the example from Google

I'm trying to test Gmaps example of Android developer from Android SDK Manager.
The Google Play Service was imported as a Library.
The libs folder was cleaned from the library project;
The maps sample was imported;
In project properties --> Android, I have the following configs:
Google API's instead of standard Android;
Library --> Google play services is green.
The errors that are presented:
The import com.google.android.gms.location cannot be resolved
The method setImage(BitmapDescriptor) is undefined for the type
GroundOverlay
The method flat(boolean) is undefined for the type MarkerOptions,
and others methods undefined.
I'm newbie in Android development, so.. what is wrong?
Could someone help me with this? Thanks.
Have you made changes in your manifest?What about the key which is to be registered in Google console and is to be declared in the manifest file?
Some permissions need to be declared in the manifest file like:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="com.example.gps.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
and the key is to declared in meta data:
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="your key value" />

Using Google Maps v2 in Android

i am trying to integrate Google Maps to my Android Application. I followed this tutorial: https://blog-emildesign.rhcloud.com/?p=435.
I did everything as suggested.
These are the errors in the error log:
E/Google Maps Android API(28238): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
E/Google Maps Android API(28238): Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
E/Google Maps Android API(28238): Ensure that the following correspond to what is in the API Console: Package Name: com.example.kontrollen, API Key: xxxxxxxxxxxxxx, Certificate Fingerprint: xxxxxxxxxxxxxxxxxxxxxxx
And this is my google account:
Do you have any ideas what i can do?
This is my AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.kontrollen"
android:versionCode="1"
android:versionName="1.0" >
<permission android:name="com.example.kontrollen.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<uses-permission android:name="com.example.kontrollen.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxx" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.kontrollen.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I solved the problem by uninstalling the app and cleaning the project folder. I did not change anything. Thank you for your help.
follow the url to create your app google api key i have done this recently.. and it was successful.
https://code.google.com/apis/console/ ------------ For Google API
https://developers.google.com/maps/documentation/android/start ------------ Crate Map
read these page carefully every thing is given in this page .. follow the same but make sure you have generated correct SHA1 fingerprint
and when you are going to crate the app make sure run it on real device because it need google play services to run add google pay services in your application
Edited answer:
Try putting the meta-data within the application tag, preferably right before the closing tag like
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xyz" />
</application>
Follow this steps to trace error youself
STEPS
for your error type
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
1.check for internet or gsf reader permissions in manifest as shown above.
2.check for the package name you used in you manifest.
3.check in your api console the service that you started is Google Maps Android API v2.
4.Check the library google play services is imported or not.
5.if no solution is working try out new way following this link-- https://developers.google.com/maps/documentation/android/start.
6.Also keytool command to generate sha1--i used is-
keytool -v -list -alias androiddebugkey -keystore C:/Users/username/.android/debug.keystore
I had actually made a maps activity from the studio and used the link it generated to set up the maps API. Where I went wrong was, I placed it inside a package and the package name that was registered for the app was with that folder name. For Ex.
If app package name is
com.awesome.shit
the package that was saved in API was
com.awesome.shit.maps
changed it and it started working.

Google MapFragment is blank (white) with Could not find class 'maps.j.k'

I'm trying to build the official android google map api v2 sample on a (gingerbread 2.3.5) phone .
I added android-support-v4.jar to official sample project.
I took the sample from the official tutorial in <android-sdk>/extras/google-play-services/samples/maps
I copied the sample app in Eclipse, reference the google-play-services_lib project as an Android library, and build the whole thing with the Android SDK 4.1.2 (api 16).
Unfortunately, ahen I launch the app the map is blank and I don't have any exception or message.
The only thing I got are those suspicious lines in the logcat :
Unable to resolve superclass of Lmaps/a/du; (411)
Link of class 'Lmaps/a/du;' failed
Unable to resolve superclass of Lmaps/a/ej; (2363)
Link of class 'Lmaps/a/ej;' failed
Unable to resolve superclass of Lmaps/j/k; (2379)
Link of class 'Lmaps/j/k;' failed
ERR Could not find class 'maps.j.k', referenced from method maps.y.ae.a
VFY: unable to resolve new-instance 3571 (Lmaps/j/k;) in Lmaps/y/ae;
I suspect that my project structure in eclipse 3.8 is somewhat messed up.
I tried the following things (even the most idiotic) to no avail.
1. Invalid api key ?
I generated a "debug.keystore" with keytool and updated the eclipse preference (Android/Build/Keystore).
Of course, I registered that new keystore/SHA1 and get a new api key that I used in the AndroidManifest file
2. Wrong project target ?
I tried to build my two projects with the following targets :
Android 4.2.1
Google Api 4.2.1
3. adding google-play-services_lib as a project dependency
I tried to add google-play-services_lib as a project dependency on top of being added as an android library in the demo build path.
And tick the matching export checkbox.
4. test google maps api v2 on the phone
I downloaded trulia real estate app that is said to use the v2 api on the phone to be sure that the phone is compatible with the new api
Here is the manifest for the sample app
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mapdemo"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="com.example.mapdemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE" />
<!-- Copied from Google Maps Library/AndroidManifest.xml. -->
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!-- External storage for caching. -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- My Location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Maps API needs OpenGL ES 2.0. -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<!-- End of copy. -->
<application
android:hardwareAccelerated="true"
android:icon="#drawable/ic_launcher"
android:label="#string/demo_title" >
<!-- You must insert your own Google Maps for Android API v2 key in here. -->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="XXXXXXXX" />
<activity android:name=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".BasicMapActivity"
android:label="#string/basic_map" />
<activity
android:name=".CameraDemoActivity"
android:label="#string/camera_demo" />
<activity
android:name=".EventsDemoActivity"
android:label="#string/events_demo" />
<activity
android:name=".GroundOverlayDemoActivity"
android:label="#string/groundoverlay_demo" />
<activity
android:name=".LayersDemoActivity"
android:label="#string/layers_demo" />
<activity
android:name=".LocationSourceDemoActivity"
android:label="#string/locationsource_demo" />
<activity
android:name=".MarkerDemoActivity"
android:label="#string/marker_demo" />
<activity
android:name=".OptionsDemoActivity"
android:label="#string/options_demo" />
<activity
android:name=".PolygonDemoActivity"
android:label="#string/polygon_demo" />
<activity
android:name=".PolylineDemoActivity"
android:label="#string/polyline_demo" />
<activity
android:name=".ProgrammaticDemoActivity"
android:label="#string/programmatic_demo" />
<activity
android:name=".TileOverlayDemoActivity"
android:label="#string/tile_overlay_demo" />
<activity
android:name=".UiSettingsDemoActivity"
android:label="#string/uisettings_demo" />
<activity
android:name=".RawMapViewDemoActivity"
android:label="#string/raw_mapview_demo" />
<activity
android:name=".RetainMapActivity"
android:label="#string/retain_map" />
<activity
android:name=".MultiMapDemoActivity"
android:label="#string/multi_map_demo" />
</application>
</manifest>
Here are some screenshots of my project structure/build path.
I think maybe you make something wrong when you apply the api KEY.
I have the same problem, and at last I found that I turn on the incorrect service. at https://code.google.com/apis/console/,
There are Google Maps API v2 and Google Maps Android API v2.
You should use Google Maps Android API v2.
I had exactly the same problem (all configurations the same, maps.j.k stuff in the logcat). However, for me choosing Google APIs as build target solved it. But that was Google APIs 4.2, so I suggest that you install the update and try with the more recent target.
I resolved this issue by changing de targetSdkVersion with de last targetSdkVersion avaiable, at the AndroiMainfest.xml file.
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
Are you using ProGuard? Usually class names like "a", "b", etc. are a result of ProGuard obfuscating class names, and maybe the Maps API breaks when that happens. If that's the case, you will either have to disable ProGuard or add some -keep lines to your proguard.cfg file. This post shows what those lines might look like.
In my case it was due to 2 issues
on my phone the latest Google Maps app was not installed (in fact there was no google maps at all)
I didnt have all the required permissions set in my manifest
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
As documented in https://developers.google.com/maps/documentation/android/start#installing_the_google_maps_android_v2_api
http://developer.android.com/sdk/index.html --this is the link for the adt bundle in android..try downloading this and start over again..maybe there's a problem with your ADT.
Check the console API you've enabled Google Maps Android API v2
I was dealing with same issue. I tried to implement the com.example.mapdemo and had a heck of a time.
I copied the code of the BasicMapActivity to a clean new project and made the Libraries look as above.
Basically, I couldn't get either to work. I got the "Authorization failure" error in the debugger.
Then, today, I prepared new keys specifically for each project with the specific com.example.xxx after the semicolon when preparing the key in the Google Console.
I did Project->Clean at every step.
I ran it in debugger first, then just Run. And, if I remember, a few times after making the change to the manifest.
Then, finally, they worked. It seemed, in the end, to require a key for each specific project.
Here's what worked for me. When you use the Google APIs Console to create your API key, be sure to append ;com.example.mapdemo to the SHA1 fingerprint. (I was using something else more appropriate for another app I'm currently developing.) What clued me in on this solution was an authorization error in the LogCat.
In my case I added LocationSource Interface so I can get location data but i forgot to add :
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
at Manifest file.
Don't forget to use separate keys for debug and release version of the app!
If you have already tried everything, try to uninstall and reinstall again your app: on my phone (S3 mini), after the first launch with the wrong key, I corrected it, but it didn't work until a complete uninstallation.
Maybe some sort of caching is used.

Categories

Resources