RecycleViewを使おうとして、上記のエラーに遭遇しました。
実機で実行すると、レイアウトファイルのinflate時にこのエラーでクラッシュします。
数時間ぐらい悩んだんですよねー。
多くのサイトに
import android.support.v7.widget.RecyclerView
を
import androidx.recyclerview.widget.RecyclerView
にすべしというのが書いてありますがっ。それはやってあるんだよなー。(´ω`)
下記のサイトに答えがありました。
https://tutorialmore.com/questions-296241.htm
レイアウトファイルのRecycleViewの指定を下記から
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
次に変更します。
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
これで、クラッシュしなくなりました!
P.S こういう自動翻訳サイトって読みづらいので避けていたんですが、最近は、こういうので助かるケースも増えてきました。
![](https://i2.wp.com/oc-technote.com/wp-content/uploads/2020/01/DW174_L.jpg?w=525&ssl=1)