title: Why google map v2 suddenly crashed by java.lang.NullPointerException: Attempt to get length of null array?
body: <p>I have an issue that caused by NullPointerException. <strong>App starts crashing today when i'm trying to do mMapView.onCreate(savedInstanceState);</strong> but yesterday it was fine. I just change my layout file to another (similar) with another name. 
  Here's exception: </p>
  
  <blockquote>
    <p>E/AndroidRuntime: FATAL EXCEPTION: main
         Process: com.parking.android, PID: 17585
                                                                         java.lang.NullPointerException: Attempt to get length of null array
                                                                             at maps.G.a.a(Unknown Source)
                                                                             at maps.V.N.a(Unknown Source)
                                                                             at maps.D.e.a(Unknown Source)
                                                                             at maps.D.p.a(Unknown Source)
                                                                             at maps.ad.ae.a(Unknown Source)
                                                                             at maps.ad.t.a(Unknown Source)
                                                                             at maps.ad.R.a(Unknown Source)
                                                                             at uo.onTransact(:com.google.android.gms.DynamiteModulesB:66)
                                                                             at android.os.Binder.transact(Binder.java:385)
                                                                             at
    com.google.android.gms.maps.internal.IMapViewDelegate$zza$zza.onCreate(Unknown
    Source)
                                                                             at com.google.android.gms.maps.MapView$zza.onCreate(Unknown Source)
                                                                             at com.google.android.gms.dynamic.zza$3.zzb(Unknown Source)
                                                                             at com.google.android.gms.dynamic.zza$1.zza(Unknown Source)
                                                                             at com.google.android.gms.maps.MapView$zzb.zzbow(Unknown Source)
                                                                             at com.google.android.gms.maps.MapView$zzb.zza(Unknown Source)
                                                                             at com.google.android.gms.dynamic.zza.zza(Unknown Source)
                                                                             at com.google.android.gms.dynamic.zza.onCreate(Unknown Source)
                                                                             at com.google.android.gms.maps.MapView.onCreate(Unknown Source)
                                                                             at
    com.parking.android.map.fragment.MapsFragment.initMap(MapsFragment.java:105)
                                                                             at
    com.parking.android.map.fragment.MapsFragment.onCreateView(MapsFragment.java:92)
                                                                             at
    com.parking.android.base_arch.fragment.BaseFragment.onCreateView(BaseFragment.java:48)
                                                                             at
    android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
                                                                             at
    android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
                                                                             at
    android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
                                                                             at
    android.support.v4.app.BackStackRecord.run(BackStackRecord.java:742)
                                                                             at
    android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
                                                                             at
    android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
                                                                             at android.os.Handler.handleCallback(Handler.java:815)
                                                                             at android.os.Handler.dispatchMessage(Handler.java:104)
                                                                             at android.os.Looper.loop(Looper.java:194)
                                                                             at android.app.ActivityThread.main(ActivityThread.java:5550)
                                                                             at java.lang.reflect.Method.invoke(Native Method)
                                                                             at java.lang.reflect.Method.invoke(Method.java:372)
                                                                             at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:955)
                                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750)</p>
  </blockquote>
  
  <p>And here is some of my code with mapView:</p>
  
  <pre><code>@Override
  protected void onCreateView(Bundle savedInstanceState) {
      super.onCreateView(savedInstanceState);
      initMap(savedInstanceState);
  }
  private void initMap(Bundle savedInstanceState) {
      mMapView.onCreate(savedInstanceState);
      mMapView.onResume();
      try {
          MapsInitializer.initialize(getActContext());
      } catch (Exception e) {
          e.printStackTrace();
      }
      mMapView.getExtendedMapAsync(this);
      locationManager = (LocationManager) getContext().getSystemService(Context.LOCATION_SERVICE);
      try {
          locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 400, 1000, this);
      } catch (SecurityException e) {
          Log.e(TAG, "onLocationChanged: ", e);
      }
  }
  @Override
  public void onPause() {
      mMapView.onPause();
      super.onPause();
  }
  
  @Override
  public void onResume() {
      super.onResume();
      mMapView.onResume();
  }
  
  @Override
  public void onDestroy() {
      mMapView.onDestroy();
      super.onDestroy();
  }
  @Override
  public void onMapReady(GoogleMap googleMap) {
      mMap = googleMap;
      presenter.getParkings();
      mMap.setOnMarkerClickListener(this);
      mMap.setMyLocationEnabled(true);
      mMap.getUiSettings().setMyLocationButtonEnabled(false);
  
  }
  @Override
  public void onLocationChanged(Location location) {
      if (mMap == null)
          return;
      LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
      CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, 14);
      mMap.animateCamera(cameraUpdate);
      try {
          locationManager.removeUpdates(this);
      } catch (SecurityException e) {
          Log.e(TAG, "onLocationChanged: ", e);
      }
  }
  </code></pre>