简体   繁体   English

Android支持库v4 sherlock和SwipeRefreshLayout冲突

[英]Android Support library v4 sherlock and SwipeRefreshLayout conflict

I had a request to implement SwipeRefreshLayout which is included in later versions of support v4 library. 我请求实现SwipeRefreshLayout,该请求包含在支持v4库的更高版本中。 Prior to that my project already had dependency to actionbarsherlock which is also referencing obviously some older version of support v4 library that does not have SwipeRefreshLayout in it. 在此之前,我的项目已经依赖于actionbarsherlock,后者显然还引用了其中没有SwipeRefreshLayout的某些较旧版本的支持v4库。 My google maps map fragment is working fine with that old support library that is actionbarsherlock currently using but when I replace that lib with the new one that has SwipeRefreshLayout in it my map fragment is always null and I can't the map and SwipeRefreshLayout to work at the same time, one is excluding the other one for some reason and I can't have two version of support v4 libraries because project can't compile because of conflicting class names. 我的Google Maps地图片段可以与当前使用的actionbarsherlock的旧支持库配合使用,但是当我用其中包含SwipeRefreshLayout的新库替换该lib时,我的地图片段始终为null,而我的地图和SwipeRefreshLayout无法正常工作同时,一个由于某种原因将另一个排除在外,我不能拥有两个版本的支持v4库,因为项目由于类名冲突而无法编译。

The are few question: 有几个问题:

1.Can I somehow add SwipeRefreshLayout to my project without adding the whole new version of support v4 library ( because map fragment stops working with this version ) ? 1.我能以某种方式将SwipeRefreshLayout添加到我的项目中而不添加支持v4库的整个新版本吗(因为地图片段停止与此版本一起使用)?

2.Can I have two versions of support libraries in a project and to still be able to compile it ? 2.我可以在一个项目中拥有两个版本的支持库,并且仍然可以对其进行编译吗?

3.Is there any other simpler solution two have both maps and SwipeRefreshLayout working? 3.是否还有其他更简单的解决方案,两个都可以使用map和SwipeRefreshLayout?

Thanks in advance. 提前致谢。

Solution is to use next 解决方法是使用下一步

allprojects {
repositories {
    jcenter()
}
configurations.all((Closure) {
    resolutionStrategy {
        force 'com.android.support:support-annotations:21.0.2'
        force 'com.android.support:support-v4:21.0.2'
        force 'com.android.support:support-v13:21.0.2'
    }
})

at your root (top) build.gradle 在您的根(顶部) build.gradle

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM