1

The Google map API V2 shows blank screen even I use the mapdemo project in Google play service sample

  • I reinstall google play service SDK.
  • I changed the API key
  • I changed the debug.keystore and re-generate the sha1 fingerprint

nothing changed...

and mMap is always turning out to be null ?

if (mMap == null) { 
// Try to obtain the map from the SupportMapFragment. 
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)) .getMap(); 
// Check if we were successful in obtaining the map. 
if (mMap != null) { 
setUpMap(); 
}
MostafaMashayekhi
  • 27,359
  • 3
  • 21
  • 39
  • Always show the code you have tried along with the question. Secondly have allowed the internet permissions in you Manifest.xml ? – Jibran Khan May 21 '13 at 13:15
  • Yes i allow the internet if (mMap == null) { // Try to obtain the map from the SupportMapFragment. mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)) .getMap(); // Check if we were successful in obtaining the map. if (mMap != null) { setUpMap(); } mMap is always null any reason? – Nesreen Mansour May 21 '13 at 13:16
  • Follow the link carefully, will surely work https://developers.google.com/maps/documentation/android/map – Jibran Khan May 21 '13 at 13:27
  • plz put your xml file,? – TamiL May 21 '13 at 13:29
  • @jibran i'm did those steps – Nesreen Mansour May 21 '13 at 13:39
  • @NesreenMansour is it something like this? http://stackoverflow.com/a/15636254/763459 I have encountered similar issues and solved by updating the device's time to the current time. – dumbfingers May 21 '13 at 14:41

3 Answers3

1

This problem (Blank map with zoom control) is usually derived from the fact that you didn't referenced google-play-services library correctly, or haven't configured the API in the console the right way.

You can take a look at this blog post I wrote on how to integrate Google Maps API V2 in your application:

Google Maps API V2

Follow the first 3 steps for correct google-play-services library integration.

Or check this post for the right configuration in the API console:

Google Maps API V2 key

Emil Adz
  • 40,709
  • 36
  • 140
  • 187
  • please show more of your code: the manifest file, xml layout file and your map class. – Emil Adz May 21 '13 at 13:39
  • i use the sample project in Desktop\sdk\extras\google\google_play_services\samples\maps i didn't change anything except the api key – Nesreen Mansour May 21 '13 at 13:48
  • If you used the sample project then my guess would be that you are not configuring your API Console correctly. try to go over the second guide I posted. – Emil Adz May 21 '13 at 13:55
  • no i created new api key with package name and debug.keystore – Nesreen Mansour May 21 '13 at 13:55
  • @NesreenMansour, as the result you are receiving is not the desired result, the conclusion is that you are doing something wrong. take a look at the steps of both guide and make sure you are making all of them right. – Emil Adz May 21 '13 at 13:57
  • Emil i used your blog to create my first app and it really helps me i can't deny but i created an app it works very well but once the map disappeared i changed the api key and debug.keystore file but nothing changed – Nesreen Mansour May 21 '13 at 14:02
0

is your map showing zoom in-out signs?

Edit: try out like this.. i also had the same problem as yours.. and happened to solve it as below

android.support.v4.app.FragmentManager myFragmentManager = getSupportFragmentManager();
    SupportMapFragment mySupportMapFragment = (SupportMapFragment) myFragmentManager
            .findFragmentById(R.id.map);
    googleMap = mySupportMapFragment.getMap();
mn0102
  • 839
  • 1
  • 12
  • 25
  • i dont know why i cant directly post a comment just below your question.. sorry that i had to ask the question in answering section then – mn0102 May 21 '13 at 13:19
  • not this way mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)) .getMap(); try my way.. a minor difference is there – mn0102 May 21 '13 at 13:26
  • still same blank screen nothing changed – Nesreen Mansour May 21 '13 at 13:30
  • something went wrong in Map Key then.. make sure that you are using the Map key for that app which is registered during the generation of the key.. – mn0102 May 21 '13 at 13:37
  • if nothing worked out delete/(remove it from the location and keep a copy of it) your debug.keystore file clean your project which will generate a new copy of debug.keystore file and try giving SHA1 fingerprint of it and generate a new key – mn0102 May 21 '13 at 13:50
  • i did this step too :\ and nothing changed – Nesreen Mansour May 21 '13 at 13:53
  • Aditya one more question i created a project with googla map i worked very well and once the map become blank what that mean? sure i'll tell but i'm really disappointed i think won't the solution – Nesreen Mansour May 21 '13 at 13:59
  • i did not get you.. but you'll definately come over this.. try and find other ways.. – mn0102 May 21 '13 at 14:09
0

Actually I find that the device operating system just can handle map view not the map fragment.