I have an Android application module (app) and an Android library module (library). Both app and library contain these same dependencies:
dependencies {
The dependencies block(closure) needs DependencyHandler as delegate
You need to pass DependencyHandler of each project to shared dependencies in project gradle.build.
project build.gradle
ext.sharedGroup = {dependencyHandler->
delegate = dependencyHandler
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'io.reactivex:rxjava:1.0.13'
compile 'io.reactivex:rxandroid:0.25.0'
}
app build.gradle
dependencies {
sharedGroup dependencies
}
ref. https://github.com/b1uec0in/DependencyVersionResolver
(see 2. Using default dependency group. This sample explains many other tips for sharing library version, sdk versions ... for large project that have many modules.)