Skip to content Skip to sidebar Skip to footer

Nullpointerexception : Attempt To Invoke Virtual Method 'void Com.google.android.gms.maps.mapfragment.getmapasync

I'm using com.google.android.gms:play-services-maps:11.0.2 version of Google Map Service. When trying to call the below, I get the following error: java.lang.NullPointerException:

Solution 1:

Looks like you are using SupportMapFragment instead of MapFragment.

Change this line:

mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);

To this:

mapFragment = (MapFragment) getSupportFragmentManager().findFragmentById(R.id.map);

Post a Comment for "Nullpointerexception : Attempt To Invoke Virtual Method 'void Com.google.android.gms.maps.mapfragment.getmapasync"