Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple versions of same library

I have project A, which used to have module A1, that used dagger v. 1.2.2. Now I'd like to add to project A, module A2, that has dependency on dagger v. 2.0. But I can't because these two dagger libs are in conflict. Can I approach somehow multiple versions of library in different android modules?

like image 427
Fishman Avatar asked Sep 04 '15 10:09

Fishman


1 Answers

You can't have both.

You need to exclude the conflicting libraries from dependencies:

configurations {
    all*.exclude group: 'com.google.android', module: 'support-v4'
}

dependencies {
    compile 'com.android.support:support-v4:13.0.0'
}

From: https://github.com/stephanenicolas/robospice/issues/161

OR

dependencies {
    compile("org.gradle.test.excludes:api:1.0") {
        exclude module: 'shared'
    }
}

From: https://docs.gradle.org/current/userguide/dependency_management.html #52.4.7

like image 71
shkschneider Avatar answered Sep 30 '22 20:09

shkschneider