title: Error inflating class fragment in Google Map
body: <p>I just learned Android and I have some problems when I run the Google Map code.
  I've tried lots of solutions in stack overflow:</p>
  
  <ol>
  <li>Mainactivity.java: extends FragmentActivity instead of Activity</li>
  <li>activity_main.xml: change the name of fragment to "com.samplefragsapplication.SuggestionFrags" or "com.google.android.gms.maps.SupportMapFragment"</li>
  </ol>
  
  <p>and it still not work.</p>
  
  <p>this is the activity_main.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;fragment xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/map"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:name="com.google.android.gms.maps.MapFragment"/&gt;
  </code></pre>
  
  <p>this is the Mainactivity.java</p>
  
  <pre><code>package com.example.asg2b;
  
  import android.app.Activity;
  import android.os.Bundle;
  
  public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
  }
  </code></pre>
  
  <p>this is the Manifest.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.asg2b"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="19" /&gt;
  
      &lt;permission
          android:name="com.example.asg2b.permission.MAPS_RECEIVE"
          android:protectionLevel="signature" &gt;
      &lt;/permission&gt;
  
      &lt;uses-permission android:name="com.example.asg2b.permission.MAPS_RECEIVE" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  
      &lt;uses-feature
          android:glEsVersion="0x00020000"
          android:required="true" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name="com.example.asg2b.MainActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
          &lt;meta-data
              android:name="com.google.android.maps.v2.API_KEY"
              android:value="Android Key" /&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>and this is the log I got from LogCat</p>
  
  <pre><code>12-01 14:48:08.705: D/dalvikvm(14191): GC_CONCURRENT freed 312K, 4% free 12919K/13447K, paused 4ms+3ms
  12-01 14:48:08.870: D/dalvikvm(14191): GC_CONCURRENT freed 306K, 5% free 13073K/13639K, paused 1ms+7ms
  12-01 14:48:09.055: D/dalvikvm(14191): GC_CONCURRENT freed 360K, 5% free 13179K/13767K, paused 3ms+6ms
  12-01 14:48:09.090: D/AndroidRuntime(14191): Shutting down VM
  12-01 14:48:09.090: W/dalvikvm(14191): threadid=1: thread exiting with uncaught exception (group=0x40c681f8)
  12-01 14:48:09.110: E/AndroidRuntime(14191): FATAL EXCEPTION: main
  12-01 14:48:09.110: E/AndroidRuntime(14191): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.asg2b/com.example.asg2b.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.app.ActivityThread.access$600(ActivityThread.java:128)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.os.Handler.dispatchMessage(Handler.java:99)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.os.Looper.loop(Looper.java:137)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.app.ActivityThread.main(ActivityThread.java:4514)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at java.lang.reflect.Method.invokeNative(Native Method)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at java.lang.reflect.Method.invoke(Method.java:511)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at dalvik.system.NativeStart.main(Native Method)
  12-01 14:48:09.110: E/AndroidRuntime(14191): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:280)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.app.Activity.setContentView(Activity.java:1892)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at com.example.asg2b.MainActivity.onCreate(MainActivity.java:11)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.app.Activity.performCreate(Activity.java:4562)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at com.lbe.security.service.core.client.b.x.callActivityOnCreate(Unknown Source)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    ... 11 more
  12-01 14:48:09.110: E/AndroidRuntime(14191): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 4030500 but found 0.  You must have the following declaration within the &lt;application&gt; element:     &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt;
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at com.google.android.gms.maps.internal.q.v(Unknown Source)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at com.google.android.gms.maps.internal.q.u(Unknown Source)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at com.google.android.gms.maps.MapFragment$b.cE(Unknown Source)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at com.google.android.gms.dynamic.a.a(Unknown Source)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.app.Activity.onCreateView(Activity.java:4339)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:673)
  12-01 14:48:09.110: E/AndroidRuntime(14191):    ... 21 more
  12-01 14:48:18.250: D/dalvikvm(14191): GC_CONCURRENT freed 516K, 6% free 13130K/13895K, paused 5ms+4ms
  </code></pre>