title: androidx.cardview.widget.CardView cannot be cast to androidx.recyclerview.widget.RecyclerView
body: <p>I am making a project but when I compile my project and launch the app on Android Studio my app crashes. </p>
  
  <p>In my Logcat error</p>
  
  <pre><code>Process: com.passionategeekz.learnC, PID: 5854
  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.passionategeekz.learnC/com.passionategeekz.learnC.card}: java.lang.ClassCastException: androidx.cardview.widget.CardView cannot be cast to androidx.recyclerview.widget.RecyclerView
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2895)
      at android.app.ActivityThread.-wrap11(Unknown Source:0)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1616)
      at android.os.Handler.dispatchMessage(Handler.java:106)``
  </code></pre>
  
  <p>My card.java</p>
  
  <pre><code>  package com.passionategeekz.learnC;
  
      import android.os.Bundle;
  
      import androidx.appcompat.app.AppCompatActivity;
      import androidx.recyclerview.widget.DefaultItemAnimator;
      import androidx.recyclerview.widget.LinearLayoutManager;
      import androidx.recyclerview.widget.OrientationHelper;
      import androidx.recyclerview.widget.RecyclerView;
  
      import java.util.ArrayList;
  
  
      public class card extends AppCompatActivity {
  
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.card);
  
  
              ArrayList&lt;model&gt; list= new ArrayList();
              list.add(new model(model.TEXT_TYPE,"xxx",0));
              list.add(new model(model.IMAGE_TYPE,"xx",R.drawable.wtc));
              list.add(new model(model.AUDIO_TYPE,"xx",R.raw.sound));
              list.add(new model(model.IMAGE_TYPE,"xx",R.drawable.snow));
  
              MultiViewTypeAdapter adapter = new MultiViewTypeAdapter(list,this);
              LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this,OrientationHelper.VERTICAL,false);
  
              RecyclerView mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
              mRecyclerView.setLayoutManager(linearLayoutManager);
              mRecyclerView.setItemAnimator(new DefaultItemAnimator());
              mRecyclerView.setAdapter(adapter);
          }
      }
  </code></pre>
  
  <p>My card.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"
      tools:context="com.passionategeekz.learnC.MainActivity"&gt;
  
  
      &lt;androidx.cardview.widget.CardView
          android:id="@+id/recyclerView"
          android:layout_width="350dp"
          android:layout_height="447dp"
          app:layout_behavior="@string/appbar_scrolling_view_behavior"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"&gt;
  
      &lt;/androidx.cardview.widget.CardView&gt;
  
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  
  <p>My Gradle:</p>
  
  <pre><code>implementation "androidx.cardview:cardview:1.0.0"
  implementation 'androidx.recyclerview:recyclerview:1.1.0'
  </code></pre>