Check if you have referenced the id of fragment right.
public final GoogleMap getMap ()
Gets the underlying GoogleMap that is tied to the view wrapped by this fragment.
Returns
the GoogleMap. Null if the view of the fragment is not yet ready.
This can happen if the fragment lifecyle have not gone through
onCreateView(LayoutInflater, ViewGroup, Bundle) yet. This can also
happen if Google Play services is not available. If Google Play
services becomes available afterwards and the fragment have gone
through onCreateView(LayoutInflater, ViewGroup, Bundle), calling this
method again will initialize and return the GoogleMap.
It is better to chekc the availability of google play services before initializing map object.
Edit:
yes inside fragment
What you have done
android:name="com.google.android.gms.maps.MapFragment"
Its a MapFragment
.
But you have
googleMap = ((SupportMapFragment) getFragmentManager()
.findFragmentById(R.id.map)).getMap();
which is wrong
What you need to do
So you want map inside a fragment. So you need to extend MapFragment
instead of Fragment
or you should use MapView
Check the below
Android - android.view.InflateException: Binary XML file line #8: Error inflating class fragment