简体   繁体   中英

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. 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. 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.

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 ) ?

2.Can I have two versions of support libraries in a project and to still be able to compile it ?

3.Is there any other simpler solution two have both maps and SwipeRefreshLayout working?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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