title: Didn't find class "android.view.fragment"
body: <p>I'm getting the errors:</p>
  
  <blockquote>
    <p>Caused by: android.view.InflateException: Binary XML file line #1:
    Error inflating class fragment Caused by:
    java.lang.ClassNotFoundException: Didn't find class
    "android.view.fragment" on path: DexPathList[[zip file
    "/data/app/com.rankov.maplistener-1/base.apk"],nativeLibraryDirectories=[/vendor/lib,
    /system/lib]]</p>
  </blockquote>
  
  <p>On this line </p>
  
  <pre><code>inflate(getContext(), R.layout.activity_maps, this);
  </code></pre>
  
  <p>Here is my xml</p>
  
  <pre><code>&lt;fragment xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:map="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/map"
      android:name="com.google.android.gms.maps.SupportMapFragment"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="com.rankov.maplistener.MapsActivity"&gt;
  
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;FrameLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_margin="10dp"
              android:background="@drawable/abc_popup_background_mtrl_mult"&gt;
  
              &lt;fragment
                  android:id="@+id/autocomplete_fragment"
                  android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content" /&gt;
  
          &lt;/FrameLayout&gt;
  
          &lt;Button
              android:id="@+id/button_done"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:layout_centerHorizontal="true"
              android:layout_margin="10dp"
              android:background="@drawable/abc_popup_background_mtrl_mult"
              android:text="@string/done" /&gt;
  
      &lt;/RelativeLayout&gt;
  
  &lt;/fragment&gt;
  </code></pre>
  
  <p>Here is my view</p>
  
  <pre><code>public class MapsView extends FrameLayout implements OnMapReadyCallback, PlaceSelectionListener, View.OnClickListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
  
      private static final String TAG = "qwe";
      private Maps maps;
      private SupportMapFragment mapFragment;
      private GoogleApiClient mGoogleApiClient;
      private PlaceAutocompleteFragment autocompleteFragment;
      private Button button_done;
  
      private Location userLocation;
  
      public MapsView(Context context) {
          super(context);
          init();
      }
  
      private void init() {
          inflate(getContext(), R.layout.activity_maps, this);
  
          android.support.v4.app.FragmentActivity fragmentActivity = (android.support.v4.app.FragmentActivity) getContext();
          FragmentManager fm = fragmentActivity.getSupportFragmentManager();
          android.app.FragmentManager fm2 = fragmentActivity.getFragmentManager();
  
          //mapFragment = (SupportMapFragment) (Object) findViewById(R.id.map);
          mapFragment = (SupportMapFragment) fm.findFragmentById(R.id.map);
          mapFragment.getMapAsync(this);
  
          autocompleteFragment = (PlaceAutocompleteFragment)
                  fm2.findFragmentById(R.id.autocomplete_fragment);
          autocompleteFragment.setOnPlaceSelectedListener(this);
  
          mGoogleApiClient = new GoogleApiClient.Builder(getContext())
                  .addConnectionCallbacks(this)
                  .addOnConnectionFailedListener(this)
                  .addApi(LocationServices.API)
                  .build();
  
          button_done = (Button) findViewById(R.id.button_done);
          button_done.setOnClickListener(this);
      }
  </code></pre>
  
  <p>Started with this activity</p>
  
  <pre><code>public class MapsActivity extends FragmentActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.test_view);
          //setContentView(R.layout.activity_maps);
  
          RelativeLayout layout = (RelativeLayout) findViewById(R.id.test_layout);
          MapsView mView = new MapsView(getApplicationContext());
          layout.addView(mView);
  }
  }
  </code></pre>
  
  <p>What is the problem?</p>