title: Runtime Exception in Android application: unable to inflate MapFragment
body: <p><strong><em>i ' ve posted one question similar to this one, i' ve inserted the changes suggested to me</em></strong>, but i  can't understand why is launching this exception yet.</p>
  
  <p>manifest file:</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.testing"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="14"
          android:targetSdkVersion="19" /&gt;
  
      &lt;permission
          android:name="com.example.testing.permission.MAPS_RECEIVE"
          android:protectionLevel="signature" /&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="com.example.testing.permission.MAPS_RECEIVE" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&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;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_MOCK_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.testing.MainActivity"
              android:configChanges="orientation|keyboardHidden|screenSize"
              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>mainActivity code:</p>
  
  <pre><code>public class MainActivity extends Activity implements OnClickListener, GooglePlayServicesClient.ConnectionCallbacks,
          GooglePlayServicesClient.OnConnectionFailedListener, LocationListener {
  
      private static final long UPDATE_INTERVAL = 5000;
      private static final long FASTEST_INTERVAL = 1000;
  
      private Button showBtn;
      private GoogleMap map = null;
      private LocationClient locationClient;
      private Location myLocation;
      private LocationRequest locationRequest;
      private Display display;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          showBtn = (Button) findViewById(R.id.showBtn);
          showBtn.setOnClickListener(this);
          showBtn.setClickable(false);
  
          map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
          map.setMapType(GoogleMap.MAP_TYPE_HYBRID);
  
          display = new Display(map);
  
          locationClient = new LocationClient(this, this, this);
          locationRequest = LocationRequest.create().setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY).setInterval(UPDATE_INTERVAL)
                  .setFastestInterval(FASTEST_INTERVAL).setSmallestDisplacement(10);
  
          if (locationClient != null)
              locationClient.connect();
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
      @Override
      public void onLocationChanged(Location location) {
          Toast.makeText(this, "Location listener called", Toast.LENGTH_SHORT).show();
          LatLng newPosition = new LatLng(location.getLatitude(), location.getLongitude());
  
          myLocation = location;
          if (myLocation != null)
              showBtn.setClickable(true);
          else
              showBtn.setClickable(false);
  
          display.clearMap();
          map.animateCamera(CameraUpdateFactory.newLatLngZoom(newPosition, 16));
          display.addMarker(newPosition, "My Title", "..and my comments go here");
          display.setCircleOnMap(newPosition);
      }
  
      @Override
      public void onConnectionFailed(ConnectionResult arg0) {
      }
  
      @Override
      public void onConnected(Bundle arg0) {
          Toast.makeText(this, "Locationclient Connected", Toast.LENGTH_SHORT).show();
          locationClient.requestLocationUpdates(locationRequest, this);
      }
  
      @Override
      public void onDisconnected() {
          Toast.makeText(this, "Disconnected. Please re-connect.", Toast.LENGTH_SHORT).show();
      }
  
      @Override
      public void onClick(View v) {
          if (v.getId() == R.id.showBtn) {
              if (InternetStatus.getInstance(this).isOnline(this)) {
                  new ShowCloseUps(display, myLocation).execute();
              } else
                  Toast.makeText(this, "No internet connection find one and retry!!", Toast.LENGTH_LONG).show();
          }
      }
  
      @Override
      protected void onDestroy() {
          if (locationClient.isConnected() &amp;&amp; locationClient != null) {
              locationClient.removeLocationUpdates(this);
              locationClient.disconnect();
          }
          super.onDestroy();
      }
  }
  </code></pre>
  
  <p>activity_main.xml</p>
  
  <pre><code>    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;Button 
            android:id="@+id/showBtn"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:text="@string/show"
            /&gt;
  
        &lt;fragment 
              xmlns:map="http://schemas.android.com/apk/res-auto" 
                android:id="@+id/map"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_above="@id/showBtn"
                 android:name="com.google.android.gms.maps.MapFragment"
                map:cameraZoom="5"
                map:cameraTilt="30"
                map:uiCompass="false"
                map:uiRotateGestures="true"
                map:uiTiltGestures="true"
                map:uiZoomGestures="true"
                /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><strong>my logcat tab UPDATED:</strong></p>
  
  <pre><code>    08-11 08:46:40.250: E/AndroidRuntime(1832): FATAL EXCEPTION: main
  08-11 08:46:40.250: E/AndroidRuntime(1832): Process: com.example.testing, PID: 1832
  08-11 08:46:40.250: E/AndroidRuntime(1832): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.testing/com.example.testing.MainActivity}: android.view.InflateException: Binary XML file line #25: Error inflating class fragment
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.os.Handler.dispatchMessage(Handler.java:102)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.os.Looper.loop(Looper.java:136)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.app.ActivityThread.main(ActivityThread.java:5017)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at java.lang.reflect.Method.invokeNative(Native Method)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at java.lang.reflect.Method.invoke(Method.java:515)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at dalvik.system.NativeStart.main(Native Method)
  08-11 08:46:40.250: E/AndroidRuntime(1832): Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class fragment
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.app.Activity.setContentView(Activity.java:1929)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at com.example.testing.MainActivity.onCreate(MainActivity.java:39)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.app.Activity.performCreate(Activity.java:5231)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     ... 11 more
  08-11 08:46:40.250: E/AndroidRuntime(1832): Caused by: java.lang.IllegalArgumentException: Binary XML file line #25: Must specify unique android:id, android:tag, or have a parent with an id for null
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.app.Activity.onCreateView(Activity.java:4759)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
  08-11 08:46:40.250: E/AndroidRuntime(1832):     ... 21 more
  </code></pre>