应用程序在滚动recyclerview android崩溃

时间:2016-10-09 09:53:08

标签: android android-recyclerview

我在片段中实现了RecyclerView,它显示了三种不同类型的数据。它在启动时正确显示,但在滚动两个项目应用程序崩溃后。下面是logact和我的build.gradle的错误日志:

defaultConfig {
    applicationId 'com.app.yaw'
    minSdkVersion 16
    compileSdkVersion 23
    buildToolsVersion "23.0.3"
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
    multiDexEnabled true

}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile ('com.facebook.android:facebook-android-sdk:4.8.0'){
    exclude module: 'support-v4'
}
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.koushikdutta.ion:ion:2.+'
compile 'com.google.code.gson:gson:2.6.2'
compile('com.twitter.sdk.android:twitter:2.0.0@aar') {
    transitive = true;
}
compile 'com.android.support:recyclerview-v7:+'
}

错误:

FATAL EXCEPTION: main
                                                       Process: com.app.yaw, PID: 4842
                                                       java.lang.NoSuchMethodError: No static method getMatrix(Landroid/view/View;)Landroid/graphics/Matrix; in class Landroid/support/v4/view/ViewCompat; or its super classes (declaration of 'android.support.v4.view.ViewCompat' appears in /data/data/com.app.yaw/files/instant-run/dex/slice-com.android.support-support-v4-23.1.1_f0d40c0c98a4f0392163431bacae3584a7d8e5f6-classes.dex)
                                                           at android.support.v7.widget.RecyclerView$LayoutManager.getTransformedBoundingBox(RecyclerView.java:8100)
                                                           at android.support.v7.widget.OrientationHelper$2.getTransformedEndWithDecoration(OrientationHelper.java:402)
                                                           at android.support.v7.widget.LinearLayoutManager.recycleViewsFromStart(LinearLayoutManager.java:1275)
                                                           at android.support.v7.widget.LinearLayoutManager.recycleByLayoutState(LinearLayoutManager.java:1347)
                                                           at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1371)
                                                           at android.support.v7.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1193)
                                                           at android.support.v7.widget.LinearLayoutManager.scrollVerticallyBy(LinearLayoutManager.java:1043)
                                                           at android.support.v7.widget.RecyclerView.scrollByInternal(RecyclerView.java:1596)
                                                           at android.support.v7.widget.RecyclerView.onTouchEvent(RecyclerView.java:2704)
                                                           at android.view.View.dispatchTouchEvent(View.java:8287)
                                                           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2318)
                                                           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2050)
                                                           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
                                                           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
                                                           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
                                                           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
                                                           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
                                                           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
                                                           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
                                                           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
                                                           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
                                                           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
                                                           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
                                                           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
                                                           at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2324)
                                                           at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2064)
                                                           at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2327)
                                                           at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1705)
                                                           at android.app.Activity.dispatchTouchEvent(Activity.java:2797)
                                                           at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2288)
                                                           at android.view.View.dispatchPointerEvent(View.java:8477)
                                                           at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4281)
                                                           at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4147)
                                                           at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3652)
                                                           at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3705)
                                                           at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3671)
                                                           at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3781)
                                                           at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3679)
                                                           at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3838)
                                                           at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3652)
                                                           at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3705)
                                                           at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3671)
                                                           at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3679)
                                                           at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3652)
                                                           at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5961)
                                                        at android.view.ViewRootImpl.doProcessInputEve

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,我通过更改Project / gradle / build.gradle文件中的依赖项解决了我的问题。 对我来说问题是appcompat版本低于回收者视图。我只是更改了回收站版本以匹配appcompat。Screen shot of what and where

希望这会有所帮助 托米