title: android.view.InflateException: Binary XML file line #7: Error inflating class fragment?
body: <p>I'm trying to load a map into my application as a fragment inside a ActionBarActivity . it works fine in some devices and i'm able to see the map and zoom in and out...etc , but in some devices i get a crash message says:</p>
  
  <pre><code>2153-2188/com.mahmoud.android.MoadenLibya W/GooglePlayServicesUtil﹕ Google Play services out of date.  Requires 6587000 but found 4324038
  06-03 21:38:05.869    2153-2153/com.mahmoud.android.MoadenLibya V/mbg﹕ onPause
  06-03 21:38:05.879    2153-2153/com.mahmoud.android.MoadenLibya D/SensorManager﹕ unregisterListener ::
  06-03 21:38:05.889    2153-2153/com.mahmoud.android.MoadenLibya W/ApplicationPackageManager﹕ getCSCPackageItemText()
  06-03 21:38:05.889    2153-2153/com.mahmoud.android.MoadenLibya I/PersonaManager﹕ getPersonaService() name persona_policy
  06-03 21:38:05.899    2153-2153/com.mahmoud.android.MoadenLibya W/GooglePlayServicesUtil﹕ Google Play services out of date.  Requires 6587000 but found 4324038
  06-03 21:38:05.904    2153-2153/com.mahmoud.android.MoadenLibya W/GooglePlayServicesUtil﹕ Google Play services out of date.  Requires 6587000 but found 4324038
  06-03 21:38:05.909    2153-2153/com.mahmoud.android.MoadenLibya W/GooglePlayServicesUtil﹕ Google Play services out of date.  Requires 6587000 but found 4324038
  06-03 21:38:05.909    2153-2153/com.mahmoud.android.MoadenLibya D/AndroidRuntime﹕ Shutting down VM
  06-03 21:38:05.909    2153-2153/com.mahmoud.android.MoadenLibya W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41808c08)
  06-03 21:38:06.049    2153-2182/com.mahmoud.android.MoadenLibya D/dalvikvm﹕ GC_FOR_ALLOC freed 4921K, 15% free 40586K/47216K, paused 31ms, total 31ms
  06-03 21:38:06.064    2153-2153/com.mahmoud.android.MoadenLibya E/AndroidRuntime﹕ FATAL EXCEPTION: main
      Process: com.mahmoud.android.MoadenLibya, PID: 2153
      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mahmoud.android.MoadenLibya/com.mahmoud.android.MoadenLibya.Mosque.Mosque}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
              at android.app.ActivityThread.access$900(ActivityThread.java:161)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:157)
              at android.app.ActivityThread.main(ActivityThread.java:5356)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:515)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
              at dalvik.system.NativeStart.main(Native Method)
       Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:719)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
              at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
              at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
              at com.mahmoud.android.MoadenLibya.Mosque.Mosque.onCreate(Mosque.java:24)
              at android.app.Activity.performCreate(Activity.java:5431)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
              at android.app.ActivityThread.access$900(ActivityThread.java:161)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:157)
              at android.app.ActivityThread.main(ActivityThread.java:5356)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:515)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
              at dalvik.system.NativeStart.main(Native Method)
       Caused by: java.lang.NullPointerException
              at com.mahmoud.android.MoadenLibya.Mosque.MosqueFragment.onCreateView(MosqueFragment.java:73)
              at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786)
              at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:920)
              at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
              at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1206)
              at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2159)
              at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:297)
              at android.support.v7.app.ActionBarActivity.onCreateView(ActionBarActivity.java:547)
              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
              at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
              at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
              at com.mahmoud.android.MoadenLibya.Mosque.Mosque.onCreate(Mosque.java:24)
              at android.app.Activity.performCreate(Activity.java:5431)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
              at android.app.ActivityThread.access$900(ActivityThread.java:161)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:157)
              at android.app.ActivityThread.main(ActivityThread.java:5356)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:515)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
              at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Here'e my full code:</p>
  
  <p>in the MainActivity class i load an Activity called "Mosque" :</p>
  
  <pre><code>        Intent i = new Intent(getActivity(),Mosque.class);
          startActivity(i);
  </code></pre>
  
  <p>Mosque</p>
  
  <pre><code>package com.mahmoud.android.MoadenLibya.Mosque;
  
  import android.support.v7.app.ActionBarActivity;
  import android.os.Bundle;
  import com.mahmoud.android.MoadenLibya.R;
  
  
  public class Mosque extends ActionBarActivity {
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          setContentView(R.layout.mosque);
  
      }
  
  }
  </code></pre>
  
  <p>Mosque.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=".Mosque"&gt;
  
      &lt;fragment
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:name="com.mahmoud.android.MoadenLibya.Mosque.MosqueFragment"
          android:id="@+id/fragment"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true"/&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>MosqueFragment</p>
  
  <pre><code>package com.mahmoud.android.MoadenLibya.Mosque;
  
  import android.app.ProgressDialog;
  import android.content.Context;
  import android.location.Location;
  import android.location.LocationListener;
  import android.location.LocationManager;
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import com.mahmoud.android.MoadenLibya.R;
  import com.google.android.gms.maps.GoogleMap;
  import com.google.android.gms.maps.MapView;
  import com.google.android.gms.maps.MapsInitializer;
  import com.google.android.gms.maps.model.Marker;
  
  
  import java.util.ArrayList;
  
  
  public class MosqueFragment extends Fragment {
  
      MapView mapView;
      public static GoogleMap map;
      Location myLocation;
      LocationManager locationManager;
      LocationListener locationListener;
      private ArrayList&lt;MosqueObject&gt; mosquesArray;
      ProgressDialog mDialog;
      ArrayList&lt;Marker&gt; markers;
  
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
  
          View v = inflater.inflate(R.layout.mosque_fragment, container, false);
  
          // Gets the MapView from the XML layout and creates it
          mapView = (MapView) v.findViewById(R.id.fragment);
          mapView.onCreate(savedInstanceState);
  
          locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
  
          // Gets to GoogleMap from the MapView and does initialization stuff
          map = mapView.getMap();
          map.getUiSettings().setMyLocationButtonEnabled(true);
          map.setMyLocationEnabled(true);
          map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
          map.setInfoWindowAdapter(new PopupAdapter(getActivity().getLayoutInflater()));
  
          // Needs to call MapsInitializer before doing any CameraUpdateFactory calls
          try {
              MapsInitializer.initialize(this.getActivity());
          } catch (Exception e) {
              e.printStackTrace();
          }
  
  
  
          return v;
      }
  
  
  
  
      @Override
      public void onResume() {
          mapView.onResume();
          super.onResume();
      }
  
      @Override
      public void onDestroy() {
  
          super.onDestroy();
          mapView.onDestroy();
      }
  
      @Override
      public void onLowMemory() {
          super.onLowMemory();
          mapView.onLowMemory();
      }
  
  
  
  
  }
  </code></pre>
  
  <p>MosqueFragment.xml</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" &gt;
  
      &lt;com.google.android.gms.maps.MapView android:id="@+id/mapview"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>So what causes the error to occur ? Hope someone help me solving this problem
  Thanks</p>