secret
Created

Main build.gradle for a project that has (old versions of) ActionBarSherlock and ViewPagerIndicator included as source. These two projects are configured in the main build file.

  • Download Gist
build.gradle
Groovy
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
apply plugin: 'android'
 
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6+'
}
}
 
repositories {
mavenCentral()
}
 
version = "1.0.0"
archivesBaseName = "myapp-v${version}"
 
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
 
defaultConfig {
targetSdkVersion 19
minSdkVersion 7
versionCode 1
versionName version
}
 
// ... other config here...
}
 
dependencies {
compile 'com.android.support:support-v4:13.+'
// these are configured in this build file and in settings.gradle
compile project(':ActionBarSherlock')
compile project(':ViewPagerIndicator')
}
 
project(':ActionBarSherlock') {
apply plugin: 'android-library'
 
android {
compileSdkVersion 17
buildToolsVersion "19.0.0"
 
defaultConfig {
targetSdkVersion 16
}
 
 
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
 
dependencies {
compile 'com.android.support:support-v4:13.+'
}
}
 
project(':ViewPagerIndicator') {
apply plugin: 'android-library'
 
android {
compileSdkVersion 17
buildToolsVersion "19.0.0"
 
defaultConfig {
targetSdkVersion 16
}
 
 
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
 
dependencies {
compile 'com.android.support:support-v4:13.+'
}
}
settings.gradle
Groovy
1 2 3 4 5
include ':ActionBarSherlock', ':ViewPagerIndicator'
// Map the projects given their path on disk. This also solves a problem for me with AS not recognizing the projects
// as separate modules, but YMMV.
project(":ViewPagerIndicator").projectDir = new File("libraries/ViewPagerIndicator/library")
project(":ActionBarSherlock").projectDir = new File("libraries/ActionBarSherlock/library")

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.