使用RecycleView with support-v4:23.4.0 for CollapsingToolbarLayout app Creash时出错

时间:2016-09-28 10:41:50

标签: android android-recyclerview android-support-library android-collapsingtoolbarlayout

我在support-v4:23.4.0使用了CollapsingToolbarLayout的RecyclerView。滚动RecyclerView时,应用程序崩溃了。如果我删除compile 'com.android.support:support-v4:23.4.0'它可以正常工作但我得到了这个例外

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.awakens.wordbite/files/instant-run/dex/slice-com.android.support-support-v4-23.4.0_c149b670e0a79dbcc1eb126d08230366b4cd28ab-classes.dex)
                                                                    at android.support.v7.widget.RecyclerView$LayoutManager.getTransformedBoundingBox(RecyclerView.java:8042)

构建文件

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(path: ':library')
compile('com.mikepenz:aboutlibraries:5.5.2@aar') {
    transitive = true
    exclude module: "fastadapter"
}
compile project(path: ':TabPagerLibrary')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.firebase:firebase-auth:9.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.9.0'

compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.ogaclejapan.smarttablayout:library:1.6.1@aar'
compile 'com.ogaclejapan.smarttablayout:utils-v4:1.6.1@aar'
compile 'com.mikepenz:itemanimators:0.2.1@aar'
compile 'com.mikepenz:crossfader:1.3.2@aar'
compile 'com.mikepenz:crossfadedrawerlayout:0.3.0@aar'
compile 'com.mikepenz:google-material-typeface:2.2.0.1@aar'
compile 'com.mikepenz:fontawesome-typeface:4.4.0.1@aar'
compile 'com.mikepenz:octicons-typeface:3.0.0.1@aar'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.roughike:bottom-bar:2.+'

compile ('com.android.support:support-v4:23.4.0'){
    force = true;
}

}

3 个答案:

答案 0 :(得分:0)

只需删除以下内容

即可
compile ('com.android.support:support-v4:23.4.0'){
    force = true;
}

并检查,然后告诉我们

答案 1 :(得分:0)

你只需添加依赖

compile' com.android.support:design:23.4.0'

答案 2 :(得分:0)

您需要添加appcompat库。 只需添加此lib:

compile 'com.android.support:appcompat-v7:23.4.0'

像这样继续支持v4 lib:

compile ('com.android.support:support-v4:23.4.0'){
    force = true;
}

删除此v4 lib:

compile 'com.android.support:support-v4:23.4.0'

您需要保留一行适用于您的CollapsingToolbarLayout。