I\'m new to gradle and trying to figure out how to set it up on our Jenkins build machine. Our app builds perfectly from within Android Studio, but it doesn\'t ever generate a b
I ended up creating these build files from scratch.
Here's some guidelines:
If you have a project with multiple modules, create a settings.gradle file at the root of your project (at the same level as all the modules). Your settings.gradle file should look something like this:
include 'ActionBarSherlock'
include ':facebook-android-sdk-3.0.1:facebook'
include 'google-play-services_lib'
include ':SlidingMenu-master:library'
include 'Tinder'
include 'ViewPagerIndicator'
include 'volley'
include 'windowed-seek-bar'
Within each module, create a build.gradle file. For library projects, your build.gradle file should look something like this:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
apply plugin: 'android-library'
dependencies {
compile 'com.android.support:support-v4:13.0.0'
}
android {
buildToolsVersion "17.0"
compileSdkVersion 17
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')
}
}
For your main project, your build.gradle file should look like this:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
apply plugin: 'android'
dependencies {
compile project(':facebook-android-sdk-3.0.1:facebook')
compile project(':google-play-services_lib')
compile project(':SlidingMenu-master:library')
compile project(':ViewPagerIndicator')
compile project(':volley')
compile project(':windowed-seek-bar')
compile files('compile-libs/androidannotations-2.7.1.jar', 'libs/Flurry_3.2.1.jar', 'libs/google-play-services.jar', 'libs/gson-2.2.4.jar', 'libs/picasso-1.1.1.jar')
}
android {
buildToolsVersion "17.0"
compileSdkVersion 17
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}