Skip to content Skip to sidebar Skip to footer

In Version 2 Map View Does Not Show Map

Map Activity doesn't showing map, it's appear as just white screen with zoom control buttons. Manifest File like this :

Solution 1:

Maybe the key isn't correct. You can try the following thing:

  • Be sure you Enter your right Package name like this
  • Test on a real device which updated latest google play. Or use emulator with this guide
  • Active google map api v2 for android at google console siteenter image description here

Solution 2:

I got this problem using MapView

fragment_map.xml

<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="match_parent"android:layout_height="match_parent"><com.google.android.gms.maps.MapViewandroid:id="@+id/mapview"android:layout_width="fill_parent"android:layout_height="fill_parent"/>

@OverridepublicViewonCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
    String message = getArguments().getString(EXTRA_MESSAGE);
    v = inflater.inflate(R.layout.map_f, container, false);
    vh = newViewHolder();
    assetHandler = newAssetHandler(getActivity());
    vh.mapView=assetHandler.mapViewHandler.set(v,R.id.mapview);
    vh.mapView.onCreate(savedInstanceState);

    vh.mapView.getMapAsync(newOnMapReadyCallback() {
        @OverridepublicvoidonMapReady(GoogleMap googleMap) {
            googleMap.getUiSettings().setMyLocationButtonEnabled(true);
            googleMap.setMyLocationEnabled(true);
            // Needs to call MapsInitializer before doing any CameraUpdateFactory callstry {
                MapsInitializer.initialize(getActivity());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
    return v;
}


@OverridepublicvoidonResume() {
    super.onResume();
    vh.mapView.onResume();


}

@OverridepublicvoidonPause() {
    vh.mapView.onPause();
    super.onPause();
}

@OverridepublicvoidonDestroy() {
    vh.mapView.onDestroy();
    super.onDestroy();
}

@OverridepublicvoidonLowMemory() {
    super.onLowMemory();
    vh.mapView.onLowMemory();
}

I noticed if the LifeCycle methods are not implemented, you will not be able to see the map as well. hope this is hopeful for some.

Solution 3:

many times the problem comes from not adding the google services support in the permissions in the manifest :

check this permission is present in your manifest :

<uses-permissionandroid:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>

Solution 4:

I changed package name and update the console. I had everything correct (correct SHA1 key, package name and API key in manifest) but still got the same error message.

I had to uninstall app and restart phone for the issue to go away. It seems something was being cached.

Solution 5:

As been mentioned here this problem usually derives from the fact that you are not referencing the google-play-service library correctly. Please take a look at the first 3 steps of the following guide I wrote no integrating Google Maps in your application and make sure you are doing all the steps correctly:

Google Maps API V2

Post a Comment for "In Version 2 Map View Does Not Show Map"