title: java.lang.RuntimeException: Unable to start activity ComponentInfo on google map Activity
body: <p>I have been trying to use a google map fragment. The project works fine without the custom info window that I'm trying to add for every marker, but when I added the info window I got a NullPointerException. As shown here:</p>
  
  <pre><code>FATAL EXCEPTION: main
  Process: com.couchbase.grocerysync, PID: 6820
  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.couchbase.grocerysync/com.couchbase.grocerysync.MapsActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.google.android.gms.maps.SupportMapFragment.getMapAsync(com.google.android.gms.maps.OnMapReadyCallback)' on a null object reference
  </code></pre>
  
  <p>Below is the layout file:                                                      </p>
  
  <pre><code>&lt;com.couchbase.grocerysync.MapWrapperLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/map_relative_layout"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  &gt;
  
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
  &lt;AutoCompleteTextView
  android:id="@+id/autoCompleteTextView"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:ems="10"
  android:layout_weight="1.06"
  android:text="Please enter your place" &gt;
  &lt;requestFocus /&gt;
  &lt;/AutoCompleteTextView&gt;
  
  
  &lt;Button
  android:id="@+id/Bsearch"
  style="?android:attr/buttonStyleSmall"
  android:layout_width="90dp"
  android:layout_height="wrap_content"
  android:layout_gravity="right"
  android:onClick="onSearch"
  android:text="Search" /&gt;
  &lt;/LinearLayout&gt;
  
  &lt;fragment
      android:id="@+id/map"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      class="com.google.android.gms.maps.MapFragment" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>this is the setUpMapIfNeeded() method, called from the onCreate and where the error appears:</p>
  
  <pre><code>private void setUpMapIfNeeded() {
          if (mMap == null) {
          AutoCompleteTextView autoCompView = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView);
  
          autoCompView.setAdapter(new GooglePlacesAutocompleteAdapter(this, R.layout.list_item));
          autoCompView.setOnItemClickListener(this);
          // Try to obtain the map from the SupportMapFragment.
          SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
                  .findFragmentById(R.id.map);
          mapFragment.getMapAsync(this); //here is the error!
          // Check if we were successful in obtaining the map.
          if (mMap != null) {
              setUpMap();
          }
      }
  }
  </code></pre>
  
  <p>Any help will be appreciated!</p>