Android SupportMapFragment.getMap() returns null

后端 未结 2 971
梦如初夏
梦如初夏 2021-01-07 03:49

in my following code, getMap() returns null, which stop the app. If I don\'t do anything with the map (i.e, removing the last two lines), it shows correctly. Any idea why? T

2条回答
  •  心在旅途
    2021-01-07 04:48

    Duplicate of: SupportMapFragment.getmap() returns null

    Check your layout xml file. I noticed that I wasn't referencing: android:name="com.google.android.gms.maps.SupportMapFragment" but rather: android:name="com.google.android.gms.maps.MapFragment"

    The name should be: android:name="com.google.android.gms.maps.SupportMapFragment"

提交回复
热议问题