Recyclerview提供了错误夸大类android.support.v7.widget.RecyclerView

时间:2018-07-02 10:27:05

标签: android android-recyclerview

我正在为我的项目使用recyclerveiw。一切都很好,但是突然开始出现此错误。

  --------- beginning of crash
07-02 15:27:49.029 3175-3175/satlaa.desijewellery E/AndroidRuntime: FATAL EXCEPTION: main
Process: satlaa.desijewellery, PID: 3175
java.lang.RuntimeException: Unable to start activity ComponentInfo{satlaa.desijewellery/satlaa.desijewellery.helper_activity.DJPhotos}: android.view.InflateException: Binary XML file line #43: Binary XML file line #43: Error inflating class android.support.v7.widget.RecyclerView

Caused by: android.view.InflateException: Binary XML file line #43: Binary XML file line #43: Error inflating class android.support.v7.widget.RecyclerView
Caused by: android.view.InflateException: Binary XML file line #43: Error 
inflating class android.support.v7.widget.RecyclerView

Build.Gradle

apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '28.0.0'
defaultConfig {
    applicationId "satlaa.desijewellery"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 12
    versionName "1.2"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
sourceSets {
    main {
        res.srcDirs = ['src/main/res/layout/adapter', 'src/main/res/layout', 'src/main/res']
    }
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.gms:google-services:4.0.1'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.android.volley:volley:1.1.0'
}
apply plugin: 'com.google.gms.google-services'

我在互联网上进行了搜索,但没有找到解决方案。 我尝试重建和同步应用程序。更新了所有sdk工具,但没有解决。 我删除了所有Java代码,但仍然给出错误。

<android.support.v7.widget.RecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipToPadding="false"
    android:overScrollMode="never"
    android:scrollbars="vertical"
    app:fastScrollEnabled="true"
    android:splitMotionEvents="false"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" >
</android.support.v7.widget.RecyclerView>

1 个答案:

答案 0 :(得分:1)

app:fastScrollEnabled="true"

XML 中的这一行显示错误。只需删除它即可。