title: Binary XML file line #14: Error inflating class fragment - map v2
body: <p>I would like to use below example but when I launch it, I get these errors :</p>
  
  <p>example link :</p>
  
  <p><a href="http://wptrafficanalyzer.in/blog/driving-distance-and-travel-time-duration-between-two-locations-in-google-map-android-api-v2/" rel="nofollow">http://wptrafficanalyzer.in/blog/driving-distance-and-travel-time-duration-between-two-locations-in-google-map-android-api-v2/</a></p>
  
  <pre><code>&gt; 09-03 12:46:33.936: E/AndroidRuntime(15207): FATAL EXCEPTION: main
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):
  &gt; java.lang.RuntimeException: Unable to start activity
  &gt; ComponentInfo{in.wptrafficanalyzer.locationdistancetimemapv2/in.wptrafficanalyzer.locationdistancetimemapv2.MainActivity}:
  &gt; android.view.InflateException: Binary XML file line #14: Error
  &gt; inflating class fragment 09-03 12:46:33.936: E/AndroidRuntime(15207):
  &gt;   at
  &gt; android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2247)
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):  at
  &gt; android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2297)
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):  at
  &gt; android.app.ActivityThread.access$700(ActivityThread.java:152) 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; android.app.ActivityThread$H.handleMessage(ActivityThread.java:1282)
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):  at
  &gt; android.os.Handler.dispatchMessage(Handler.java:99) 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; android.os.Looper.loop(Looper.java:137) 09-03 12:46:33.936:
  &gt; E/AndroidRuntime(15207):  at
  &gt; android.app.ActivityThread.main(ActivityThread.java:5328) 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; java.lang.reflect.Method.invokeNative(Native Method) 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; java.lang.reflect.Method.invoke(Method.java:511) 09-03 12:46:33.936:
  &gt; E/AndroidRuntime(15207):  at
  &gt; com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):  at
  &gt; com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; dalvik.system.NativeStart.main(Native Method) 09-03 12:46:33.936:
  &gt; E/AndroidRuntime(15207): Caused by: android.view.InflateException:
  &gt; Binary XML file line #14: Error inflating class fragment 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:710)
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):  at
  &gt; android.view.LayoutInflater.rInflate(LayoutInflater.java:752) 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; android.view.LayoutInflater.inflate(LayoutInflater.java:495) 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; android.view.LayoutInflater.inflate(LayoutInflater.java:397) 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; android.view.LayoutInflater.inflate(LayoutInflater.java:353) 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:327)
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):  at
  &gt; android.app.Activity.setContentView(Activity.java:1928) 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; in.wptrafficanalyzer.locationdistancetimemapv2.MainActivity.onCreate(MainActivity.java:42)
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):  at
  &gt; android.app.Activity.performCreate(Activity.java:5250) 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):  at
  &gt; android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):  ... 11 more 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207): Caused by:
  &gt; java.lang.IllegalStateException: The meta-data tag in your app's
  &gt; AndroidManifest.xml does not have the right value.  Expected 5089000
  &gt; but found 0.  You must have the following declaration within the
  &gt; &lt;application&gt; element:     &lt;meta-data
  &gt; android:name="com.google.android.gms.version"
  &gt; android:value="@integer/google_play_services_version" /&gt; 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; com.google.android.gms.common.GooglePlayServicesUtil.A(Unknown Source)
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):  at
  &gt; com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown
  &gt; Source) 09-03 12:46:33.936: E/AndroidRuntime(15207):  at
  &gt; com.google.android.gms.maps.internal.u.I(Unknown Source) 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; com.google.android.gms.maps.internal.u.H(Unknown Source) 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):  at
  &gt; com.google.android.gms.maps.SupportMapFragment$b.jz(Unknown Source)
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):  at
  &gt; com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):  at
  &gt; com.google.android.gms.dynamic.a.a(Unknown Source) 09-03 12:46:33.936:
  &gt; E/AndroidRuntime(15207):  at
  &gt; com.google.android.gms.dynamic.a.onInflate(Unknown Source) 09-03
  &gt; 12:46:33.936: E/AndroidRuntime(15207):    at
  &gt; com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown
  &gt; Source) 09-03 12:46:33.936: E/AndroidRuntime(15207):  at
  &gt; android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):  at
  &gt; android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:682)
  &gt; 09-03 12:46:33.936: E/AndroidRuntime(15207):  ... 21 more
  </code></pre>
  
  <p>in my layout xml :</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity" &gt;
  
      &lt;TextView
          android:id="@+id/tv_distance_time"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/hello_world" 
          android:layout_alignParentTop="true" /&gt;
  
      &lt;fragment 
          android:id="@+id/map"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"        
          class="com.google.android.gms.maps.SupportMapFragment" 
          android:layout_below="@id/tv_distance_time" /&gt;    
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>in MainActivity :</p>
  
  <pre><code> SupportMapFragment fm =
   (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map);
  </code></pre>
  
  <p>My 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="info.androidhive.googlemapsv2"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;permission
          android:name="info.androidhive.googlemapsv2.permission.MAPS_RECEIVE"
          android:protectionLevel="signature" /&gt;
  
      &lt;uses-permission android:name="info.androidhive.googlemapsv2.permission.MAPS_RECEIVE" /&gt;
  
      &lt;uses-sdk
          android:minSdkVersion="12"
          android:targetSdkVersion="17" /&gt;
  
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  
      &lt;!-- Required to show current location --&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  
      &lt;!-- Required OpenGL ES 2.0. for Maps V2 --&gt;
      &lt;uses-feature
          android:glEsVersion="0x00020000"
          android:required="true" /&gt;
  
      &lt;!-- Requires OpenGL ES version 2 --&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"&gt;
          &lt;activity
              android:name="info.androidhive.googlemapsv2.MainActivity"
              android:label="@string/app_name"
              android:theme="@style/AppBaseTheme"&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;!-- Goolge API Key --&gt;
          &lt;meta-data
              android:name="com.google.android.maps.v2.API_KEY"
              android:value="AIzaSyBZ*****9p6wksdax4TEjDVLgo" /&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>updated :</strong></p>
  
  <p>I added below code to manifest.xml :</p>
  
  <pre><code>&lt;meta-data
      android:name="com.google.android.gms.version"
      android:value="@integer/google_play_services_version" /&gt; 
  </code></pre>
  
  <p>and I changed fragment element from :</p>
  
  <pre><code>&lt;fragment 
      android:id="@+id/map"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"        
      class="com.google.android.gms.maps.SupportMapFragment" 
      android:layout_below="@id/tv_distance_time" /&gt;
  </code></pre>
  
  <p>to :</p>
  
  <pre><code> &lt;fragment
      android:name="com.google.android.gms.maps.SupportMapFragment"
      xmlns:map="http://schemas.android.com/apk/res-auto"
      android:id="@+id/map"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_below="@id/tv_distance_time"/&gt; 
  </code></pre>
  
  <p>my project runs but <strong>I can not see any map on my screen</strong>.(I tested it on a real device).</p>
  
  <pre><code>09-03 14:17:26.206: E/dalvikvm(8462): Could not find class 'gpq', referenced from method gpr.a
  09-03 14:17:26.206: E/dalvikvm(8462): Could not find class 'gpq', referenced from method gpr.a
  09-03 14:17:26.206: E/dalvikvm(8462): Could not find class 'gpq', referenced from method gpr.a
  09-03 14:17:26.776: E/dalvikvm(8462): Could not find class 'com.google.android.gms.location.internal.ParcelableGeofence', referenced from method gls.a
  09-03 14:17:43.591: E/Google Maps Android API(8462): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
  </code></pre>