I am still learning about gradle but from what I have read, I am wondering if this is possible.
I have multiple android apps (app1,app2,app3), that depends on a android library (L). The android library (L) would depend on external libraries like volley, and the apps would depend on external libraries like picasso.
I dont want multiple copies of library and volley for each app. Here is what I was thinking my folder/gradle structure would look like:
app1/
settings.gradle
build.gradle
src/
com/
test/
app2/
app3/
library/
settings.gradle
build.gradle
src/
com/
test/
external/
volley/
picasso/
but I am not sure what my build.gradle file for app1 would look like since project dependencies (library) seems like it needs to be inside the app1 folder.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5+'
}
}
apply plugin: 'android'
dependencies {
compile files('libs/android-support-v4.jar')
compile project(':library')
}
android {
buildToolsVersion "17.0"
compileSdkVersion 18
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aild.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
What would be the best way for me to structure my projects to use gradle?