Ошибка надувания класса androidx.recyclerview.widget.RecycleView - PullRequest
0 голосов
/ 20 апреля 2020

Ошибка, как гласит заголовок. Я также активно искал другие вопросы со схожими проблемами, но, похоже, мне не удалось это исправить. Большинство людей использовали зависимости v7 и получили инструкции изменить их на androidx, но мои зависимости уже актуальны (из того, что я вижу). Так в чем же проблема?

XML Файл - activity_recycler_view

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/black"
    android:orientation="vertical"
    tools:context=".RecycleView">

    <androidx.recyclerview.widget.RecycleView
        android:id="@+id/recyclerview_video"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>

Мои зависимости

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.firebase:firebase-storage:19.1.1'
    implementation 'com.google.firebase:firebase-database:19.2.1'
    implementation 'com.firebaseui:firebase-ui-database:6.2.1'

    // ExoPlatyer
    implementation 'com.google.android.exoplayer:exoplayer:2.11.4'
    implementation 'com.google.android.exoplayer:exoplayer-core:2.11.4'
    implementation 'com.google.android.exoplayer:exoplayer-hls:2.11.4'
    implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:2.11.4'
    implementation 'com.google.android.exoplayer:exoplayer-dash:2.11.4'
    implementation 'com.google.android.exoplayer:exoplayer-ui:2.11.4'

    // RecycleView
    implementation "androidx.recyclerview:recyclerview:1.1.0"
    // For control over item selection of both touch and mouse driven selection
    implementation "androidx.recyclerview:recyclerview-selection:1.1.0-rc01"

    // Glide
    implementation 'com.github.bumptech.glide:glide:4.11.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'

    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

Ошибка

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.navigation, PID: 26455
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.navigation/com.example.navigation.RecycleView}: android.view.InflateException: Binary XML file line #10 in com.example.navigation:layout/activity_recycler_view: Binary XML file line #10 in com.example.navigation:layout/activity_recycler_view: Error inflating class androidx.recyclerview.widget.RecycleView
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3270)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        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:2016)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7356)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
     Caused by: android.view.InflateException: Binary XML file line #10 in com.example.navigation:layout/activity_recycler_view: Binary XML file line #10 in com.example.navigation:layout/activity_recycler_view: Error inflating class androidx.recyclerview.widget.RecycleView
     Caused by: android.view.InflateException: Binary XML file line #10 in com.example.navigation:layout/activity_recycler_view: Error inflating class androidx.recyclerview.widget.RecycleView
     Caused by: java.lang.ClassNotFoundException: androidx.recyclerview.widget.RecycleView
        at java.lang.Class.classForName(Native Method)

И ошибка попадает прямо в точку setContentView

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recycler_view);
}

Ответы [ 2 ]

0 голосов
/ 20 апреля 2020

имя класса RecyclerView не RecycleView,

ваш xml код должен быть:

<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/recyclerview_video"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
0 голосов
/ 20 апреля 2020

Я не знаю, если это опечатка в вашем посте, но она пишется: <androidx.recyclerview.widget.RecycleView вместо <androidx.recyclerview.widget.RecyclerView вы пропускаете r

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