Error inflating class androidx.recyclerview.widget.RecyclerView 异常处理

 Caused by: android.view.InflateException: Binary XML file line #3: Error inflating class androidx.recyclerview.widget.RecyclerView
     Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.recyclerview.widget.RecyclerView" on path: DexPathList[[zip file "/data/app/com.criminalintenttest-1/base.apk", zip file "/data/app/com.criminalintenttest-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.criminalintenttest-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.criminalintenttest-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.criminalintenttest-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.criminalintenttest-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.criminalintenttest-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.criminalintenttest-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.telecom.criminalintenttest-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.criminalintenttest-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.telecom.criminalintenttest-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.criminalintenttest-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.criminalintenttest-1/lib/arm64, /system/lib64, /vendor/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.view.LayoutInflater.createView(LayoutInflater.java:613)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:812)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:752)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:499)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:430)
        at com.telecom.criminalintenttest.CrimeListFragment.onCreateView(CrimeListFragment.java:28)
        at android.support.v4.app.Fragment.performCreateView(Fragment.java:2439)

studio版本不同导致

找到layout的相关文件,将androidx.recyclerview.widget.RecyclerView替换为

android.support.v7.widget.RecyclerView

你可能感兴趣的:(android)