title: Android Studio Error (RecyclerView has no LayoutManager) in Kotlin programing language
body: <p>So I Create Recyclerview on android studio use Kotlin programing language, when I run my code I Get Error, I use Android Studio Version 3.6.3 and API Version 30.</p>
  <p>this is my MainActivity.kt :</p>
  <pre><code>class MainActivity : AppCompatActivity() {
  
  
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_main)
  
      val exampleList = generateDummyList(500)
  
      recycler_view.adapter = ExampleAdapter(exampleList)
      recycler_view.layoutManager = LinearLayoutManager(this)
      recycler_view.setHasFixedSize(true)
  
  
  }
  
  private fun generateDummyList(size: Int): List&lt;ExampleItem&gt; {
      val list = ArrayList&lt;ExampleItem&gt;()
  
      for (i in 0 until size) {
          val drawable = when (i % 3) {
              0 -&gt; R.drawable.abdulhalim
              1 -&gt; R.drawable.abdulharisnasution
              else -&gt; R.drawable.abdulmuis
          }
  
          val item = ExampleItem(drawable, &quot;Item $i&quot;, &quot;Line 2&quot;)
  
          list += item
      }
      return list
  }}
  </code></pre>
  <p>this is my ExampleAdapter.kt :</p>
  <pre><code>lass ExampleAdapter(private val exampleList: List&lt;ExampleItem&gt;) : RecyclerView.Adapter&lt;ExampleAdapter.ExampleViewHolder&gt;() {
  
  
  class ExampleViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
      val imageView: ImageView = itemView.image_view
      val textView1: TextView = itemView.text_view1
      val textView2: TextView = itemView.text_view2
  }
  
  override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ExampleViewHolder {
      val itemView = LayoutInflater.from(parent.context).inflate(
          R.layout.example_item,
          parent, false
      )
  
      return ExampleViewHolder(itemView)
  }
  
  override fun onBindViewHolder(holder: ExampleViewHolder, position: Int) {
      val currentItem = exampleList[position]
  
      holder.imageView.setImageResource(currentItem.imageResource)
      holder.textView1.text = currentItem.text1
      holder.textView2.text = currentItem.text2
  }
  
  override fun getItemCount(): Int {
      TODO(&quot;Not yet implemented&quot;)
  }
  </code></pre>
  <p>}</p>
  <p>this is my ExampleItem.kt :</p>
  <pre><code>data class ExampleItem(val imageResource: Int, val text1: String, val text2: String) {
  </code></pre>
  <p>}</p>
  <p>This Is my main_activity.xml :</p>
  <pre><code>&lt;RelativeLayout
  xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
  xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
  xmlns:tools=&quot;http://schemas.android.com/tools&quot;
  android:layout_width=&quot;match_parent&quot;
  android:layout_height=&quot;match_parent&quot;
  tools:context=&quot;.MainActivity&quot;&gt;
  
  &lt;androidx.recyclerview.widget.RecyclerView
      android:id=&quot;@+id/recycler_view&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:clickable=&quot;true&quot;
      android:clipToPadding=&quot;false&quot;
      android:padding=&quot;4dp&quot;
      android:scrollbars=&quot;vertical&quot;
      tools:listitem=&quot;@layout/example_item&quot; /&gt;
  </code></pre>
  
  <p>this is my example_item.xml :</p>
  <pre><code>&lt;androidx.cardview.widget.CardView xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
  android:layout_width=&quot;match_parent&quot;
  android:layout_height=&quot;wrap_content&quot;
  android:layout_margin=&quot;4dp&quot;&gt;
  
  
  &lt;RelativeLayout
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:padding=&quot;8dp&quot;&gt;
  
      &lt;ImageView
          android:id=&quot;@+id/image_view&quot;
          android:layout_width=&quot;70dp&quot;
          android:layout_height=&quot;70dp&quot;
          android:src=&quot;@drawable/abdulhalim&quot; /&gt;
  
      &lt;TextView
          android:id=&quot;@+id/text_view1&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_toEndOf=&quot;@id/image_view&quot;
          android:layout_toRightOf=&quot;@id/image_view&quot;
          android:text=&quot;Line 1&quot;
          android:textColor=&quot;#000000&quot;
          android:textSize=&quot;18dp&quot;
          android:textStyle=&quot;bold&quot; /&gt;
  
  
      &lt;TextView
          android:id=&quot;@+id/text_view2&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_below=&quot;@id/text_view1&quot;
          android:layout_toEndOf=&quot;@id/image_view&quot;
          android:layout_toRightOf=&quot;@id/image_view&quot;
          android:text=&quot;Line 2&quot; /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  <p>&lt;/androidx.cardview.widget.CardView&gt;</p>
  <p>this is my Error ON Android Studio :</p>
  <pre><code> java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.recyclerviewbeginners/com.example.recyclerviewbeginners.MainActivity}: android.view.InflateException: Binary XML file line #9 in com.example.recyclerviewbeginners:layout/activity_main: RecyclerView has no LayoutManager androidx.recyclerview.widget.RecyclerView{233faa8 VFED..... ......I. 0,0-0,0}, adapter:null, layout:null, context:com.example.recyclerviewbeginners.MainActivity@f0dfa51
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
      at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
      at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
      at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
      at android.os.Handler.dispatchMessage(Handler.java:106)
      at android.os.Looper.loop(Looper.java:223)
      at android.app.ActivityThread.main(ActivityThread.java:7656)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
   Caused by: android.view.InflateException: Binary XML file line #9 in com.example.recyclerviewbeginners:layout/activity_main: RecyclerView has no LayoutManager androidx.recyclerview.widget.RecyclerView{233faa8 VFED..... ......I. 0,0-0,0}, adapter:null, layout:null, context:com.example.recyclerviewbeginners.MainActivity@f0dfa51
   Caused by: java.lang.IllegalStateException: RecyclerView has no LayoutManager androidx.recyclerview.widget.RecyclerView{233faa8 VFED..... ......I. 0,0-0,0}, adapter:null, layout:null, context:com.example.recyclerviewbeginners.MainActivity@f0dfa51
      at androidx.recyclerview.widget.RecyclerView.generateLayoutParams(RecyclerView.java:4514)
      at android.view.LayoutInflater.rInflate(LayoutInflater.java:1123)
      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
      at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
      at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
      at com.example.recyclerviewbeginners.MainActivity.onCreate(MainActivity.kt:14)
      at android.app.Activity.performCreate(Activity.java:7995)
      at android.app.Activity.performCreate(Activity.java:7979)
      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
      at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
      at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
      at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
      at android.os.Handler.dispatchMessage(Handler.java:106)
      at android.os.Looper.loop(Looper.java:223)
      at android.app.ActivityThread.main(ActivityThread.java:7656)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
  </code></pre>
  <p>this is my AndroidManifest.xml :</p>
  <pre><code>&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
  package=&quot;com.example.recyclerviewbeginners&quot;&gt;
  
  &lt;application
      android:allowBackup=&quot;true&quot;
      android:icon=&quot;@mipmap/ic_launcher&quot;
      android:label=&quot;@string/app_name&quot;
      android:roundIcon=&quot;@mipmap/ic_launcher_round&quot;
      android:supportsRtl=&quot;true&quot;
      android:theme=&quot;@style/AppTheme&quot;&gt;
      &lt;activity android:name=&quot;.MainActivity&quot;&gt;
          &lt;intent-filter&gt;
              &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
  
              &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>this is my styles.xml :</p>
  <pre><code>&lt;resources&gt;
  
  &lt;!-- Base application theme. --&gt;
  &lt;style name=&quot;AppTheme&quot; parent=&quot;Theme.AppCompat.Light.NoActionBar&quot;&gt;
      &lt;!-- Customize your theme here. --&gt;
      &lt;item name=&quot;colorPrimary&quot;&gt;@color/colorPrimary&lt;/item&gt;
      &lt;item name=&quot;colorPrimaryDark&quot;&gt;@color/colorPrimaryDark&lt;/item&gt;
      &lt;item name=&quot;colorAccent&quot;&gt;@color/colorAccent&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>