-4

I'm trying my hand and Android Application Development. I'm currently using Eclipse (I can't remember the version, whatever the newest is). I've crossed a bridge where I just can't seem to grasp what I'm doing wrong. I'm attempting to use the Google Maps V2 API. I've been through several documents and tried several techniques, all of which lead to the same error `Binary XML file line #11: Error inflating class fragment``

I've tried so many different answers from questions similar to mine, but to no avail. :( I can usually figure these things out, but maybe I'm just too overloaded.

<uses-sdk
    android:minSdkVersion="17"
    android:targetSdkVersion="17" />

<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVISES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="---my key----" />
</application>

`

<fragment
    android:id="@+id/map"
    android:name="com.testing.svma.MainActivity"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />

`public class MainActivity extends FragmentActivity { private GoogleMap map;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    map = ((MapFragment)getFragmentManager().findFragmentById(R.id.map)).getMap();
}`
Heshan Sandeepa
  • 3,388
  • 2
  • 35
  • 45

1 Answers1

0

Try this, Change the map fragment name as follows,

android:name="com.google.android.gms.maps.MapFragment"

And put these in to your manifest file also,

 <uses-library android:name="com.google.android.maps" />

<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
Heshan Sandeepa
  • 3,388
  • 2
  • 35
  • 45