title: Google Maps API V2 - Binary XML File line #16 : Error inflating class fragment
body: <p>I am trying to get my very fist Google Maps app using V2 API - my IDE is Eclipse - compiles well, shows up in my VDM (Nexus 7) but when I launch - it crashes. </p>
  
  <p><strong>Manifest file:</strong></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.whatson.showme"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
          &lt;uses-sdk
          android:minSdkVersion="11"
          android:targetSdkVersion="17" /&gt;
  
      &lt;permission
          android:name="com.whatson.showme.MAPS_RECEIVE"
          android:protectionLevel="signature"/&gt;
      &lt;uses-permission android:name="com.whatson.showme.permission.MAPS_RECEIVE"/&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&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;!-- The following two permissions are not required to use
           Google Maps Android API v2, but are recommended. --&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;meta-data
              android:name="com.google.android.maps.v2.API_KEY"
              android:value="*** MY API KEY*****"/&gt;       
  
          &lt;activity
              android:name="com.whatson.showme.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;/application&gt;
     &lt;/manifest&gt;
  </code></pre>
  
  <p><strong>MainActivity.java:</strong></p>
  
  <pre><code>package com.whatson.showme;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.View;
  
  
  import com.google.android.gms.maps.CameraUpdate;
  import com.google.android.gms.maps.CameraUpdateFactory;
  import com.google.android.gms.maps.GoogleMap;
  import com.google.android.gms.maps.MapFragment;
  import com.google.android.gms.maps.model.LatLng;
  import com.google.android.gms.maps.model.MarkerOptions;
  
  public class MainActivity extends Activity {
      private final LatLng LOCATION_BURNABY = new LatLng(49.27645, -122.917587);
      private final LatLng LOCATION_SURRREY = new LatLng(49.187500, -122.849000);
  
      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();
  
          map.addMarker(new MarkerOptions().position(LOCATION_SURRREY).title("Find me here!"));
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
      public void onClick_City(View v) {
          //CameraUpdate update = CameraUpdateFactory.newLatLng(LOCATION_BURNABY);
          map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
          CameraUpdate update = CameraUpdateFactory.newLatLngZoom(LOCATION_BURNABY, 9);
          map.animateCamera(update);
      }
      public void onClick_Burnaby(View v) {
          map.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
          CameraUpdate update = CameraUpdateFactory.newLatLngZoom(LOCATION_BURNABY, 14);
          map.animateCamera(update);
  
      }
      public void onClick_Surrey(View v) {
          map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
          CameraUpdate update = CameraUpdateFactory.newLatLngZoom(LOCATION_SURRREY, 16);
          map.animateCamera(update);
  
      }
  
  }
  </code></pre>
  
  <p>activity_mail.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"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context=".MainActivity" &gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/hello_world" /&gt;
  
      &lt;fragment
          class="com.google.android.gms.maps.MapFragment"
          android:id="@+id/map"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
  
          /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Log dump:</p>
  
  <pre><code>12-27 01:42:32.095: E/AndroidRuntime(753): FATAL EXCEPTION: main
  12-27 01:42:32.095: E/AndroidRuntime(753): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.whatson.showme/com.whatson.showme.MainActivity}: android.view.InflateException: Binary XML file line #16: Error inflating class fragment
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1748)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1764)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.app.ActivityThread.access$1500(ActivityThread.java:122)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1002)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.os.Handler.dispatchMessage(Handler.java:99)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.os.Looper.loop(Looper.java:132)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.app.ActivityThread.main(ActivityThread.java:4025)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at java.lang.reflect.Method.invokeNative(Native Method)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at java.lang.reflect.Method.invoke(Method.java:491)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at dalvik.system.NativeStart.main(Native Method)
  12-27 01:42:32.095: E/AndroidRuntime(753): Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class fragment
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:688)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:724)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.view.LayoutInflater.inflate(LayoutInflater.java:347)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:223)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.app.Activity.setContentView(Activity.java:1780)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at com.whatson.showme.MainActivity.onCreate(MainActivity.java:26)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1712)
  12-27 01:42:32.095: E/AndroidRuntime(753):  ... 11 more
  12-27 01:42:32.095: E/AndroidRuntime(753): Caused by: java.lang.ArrayIndexOutOfBoundsException: index=12 length=0
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.content.res.TypedArray.hasValue(TypedArray.java:656)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at com.google.android.gms.maps.model.CameraPosition.createFromAttributes(Unknown Source)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.app.Activity.onCreateView(Activity.java:4140)
  12-27 01:42:32.095: E/AndroidRuntime(753):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:664)
  </code></pre>