【发布时间】:2014-10-18 17:59:47
【问题描述】:
在下面的 build.gradle 中,我添加了配置部分以避免双重包含支持库。支持库用于主项目和依赖项目,如 facebook sdk。如果没有配置部分,我会得到“UNEXPECTED TOP-LEVEL EXCEPTION”。添加该配置会使错误消失,应用程序一切正常。
现在,我正在尝试将 RecyclerView 添加到我的应用程序中,但在为 recyclerview 充气时找不到 RecyclerView 类(尽管它可以构建)。如果我删除 facebook SDK 和配置部分,recyclerview 工作得很好。
问题:我可以对 build.gradle 进行哪些更改以使 facebook SDK 和 RecyclerView 正常工作?换句话说,为什么配置部分只排除了v4,却排除了v7?
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:+'
compile 'com.android.support:support-v13:+'
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.google.android.gms:play-services:4.4.52'
compile project(':facebook-3.15')
compile project(':parse-1.5.1')
compile project(':viewpagerindicator-2.4.1')
}
configurations {
// to avoid double inclusion of support libraries
all*.exclude group: 'com.android.support', module: 'support-v4'
}
【问题讨论】:
标签: android android-recyclerview android-gradle-plugin