"Error inflating class fragment" with google map

Solution 1:

You are extending FragmentActivity, indicating that you are trying to use the Android Support package backport of fragments. However, your <fragment> element refers to MapFragment, which is for the native API Level 11 edition of fragments.

Replace MapFragment with SupportMapFragment, and that should clear up this specific crash.

Solution 2:

I had the same problem and I did the mistake to only add one of the 2 following tags. Note that you are also missing one of these two

        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="<YOUR VALUE>"/>
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

The actual error is really misleading, as you might be thinking of some API level UI issue.

Solution 3:

Some times you are using both -

<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="<YOUR VALUE>"
/>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="<YOUR VALUE>"
/>

Make sure , Don't use both ... if you need Location , Places and maps then use geo.API_KEY and if you need places and maps then use maps.v2.API_KEY

Solution 4:

Accepted answer is correct but meaningful information i share with you, may be anyone facing same issue what i face

If everything is woking same as google code then please check manifest file in my case i added geo key and map key that's why exception occurs,

Note - do not add two keys in manifest file remove map key

meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="@string/google_maps_key"/>

above code and add this code.

 <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/auto_location"/>

 <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version"/>