I tried to make a sample project using Google Map, but I couldn\'t. Help me please!
Test Device : Android 4.0.4
Error Message :
12-2
This problem also occurs when it is not able to inflate the Fragment class mentioned in the activity_main.xml(or the XML file present under res/layout), due to a SDK version incompatibility in the andriod_manifest.xml file.
The correct versions for SDK levels to get the map on an emulator is this:
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
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.
try using
public class MainActivity extends MapActivity{
... }
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"/>