Не удалось найти следующие классы: - android .support.v7.widget.RecyclerView - PullRequest
0 голосов
/ 21 июня 2020

Я сталкиваюсь с этой проблемой при запуске моего приложения

это 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="com.example.android.shoftoh1.ImagesActivity">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</RelativeLayout>

и это отчет об отладке

W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@845bc55
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.android.shoftoh1, PID: 22641
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.shoftoh1/com.example.android.shoftoh1.ImagesActivity}: android.view.InflateException: Binary XML file line #8: Binary XML file line #8: Error inflating class android.support.v7.widget.RecyclerView
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3181)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3318)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:113)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:71)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:226)
        at android.app.ActivityThread.main(ActivityThread.java:7212)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:956)
     Caused by: android.view.InflateException: Binary XML file line #8: Binary XML file line #8: Error inflating class android.support.v7.widget.RecyclerView
     Caused by: android.view.InflateException: Binary XML file line #8: 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.android.shoftoh1-ML8fSolgofHOPaHHnMXrEg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.android.shoftoh1-ML8fSolgofHOPaHHnMXrEg==/lib/arm64, /system/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.view.LayoutInflater.createView(LayoutInflater.java:606)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:827)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:900)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:861)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
        at com.example.android.shoftoh1.ImagesActivity.onCreate(ImagesActivity.java:12)
        at android.app.Activity.performCreate(Activity.java:7378)
        at android.app.Activity.performCreate(Activity.java:7369)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3161)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3318)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:113)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:71)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2044)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:226)
        at android.app.ActivityThread.main(ActivityThread.java:7212)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:956)
I/Process: Sending signal. PID: 22641 SIG: 9
Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'

Может дайте мне совет

1 Ответ

0 голосов
/ 21 июня 2020

Проверьте свой файл gradle, возможно, вы используете AndroidX. Если это так, вам нужно использовать вид ресайклера из AndroidX

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...