我遇到了这些错误,现在不知道如何处理这些错误:
Process: com.example.padmw, PID: 13784
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.padmw/com.example.padmw.MainActivity}: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class android.support.v7.widget.RecyclerView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2913)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
Caused by: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class android.support.v7.widget.RecyclerView
Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class android.support.v7.widget.RecyclerView
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.RecyclerView" on path: DexPathList[[zip file "/data/app/com.example.padmw-O16Jmvxggn14uujqjpCoBw==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.padmw-O16Jmvxggn14uujqjpCoBw==/lib/x86, /system/lib]]
我该怎么办?
XML档案:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context=".MainActivity">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
</android.support.v7.widget.RecyclerView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</LinearLayout>
</RelativeLayout>
请告诉我您是否需要更多信息。
最佳答案
我通过更换工作
<android.support.v7.widget.RecyclerView
用
<androidx.recyclerview.widget.RecyclerView
关于java - 无法启动 Activity ComponentInfo-android.view.InflateException-android.support.v7.widget.RecyclerView,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57705466/