Android Gradle include module dependencies in another module
In your Root Project -> build.gradle you should have something like:
allprojects {
repositories {
jcenter()
}
}
Add dependencies there!!
UPDATE
If you do not want all your modules to have the common dependencies but only specific modules then do this:
- Create a folder in your Root Project/gradleScript
Create a .gradle file in this folder (e.g. gradleScript/dependencies.gradle) that looks like:
ext { //Version supportLibrary = '22.2.1' //Support Libraries dependencies supportDependencies = [ design : "com.android.support:design:${supportLibrary}", recyclerView : "com.android.support:recyclerview-v7:${supportLibrary}", cardView : "com.android.support:cardview-v7:${supportLibrary}", appCompat : "com.android.support:appcompat-v7:${supportLibrary}", supportAnnotation: "com.android.support:support-annotations:${supportLibrary}", ] }
In your root project build.gradle add this line:
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.2.3' } } // Load dependencies apply from: 'gradleScript/dependencies.gradle'
In your modules accordingly add this:
// Module build file dependencies { //...... compile supportDependencies.appCompat compile supportDependencies.design }
Hope this helps!!!