1 2 3 4 buildscript { 5 repositories { 6 mavenCentral() 7 } 8 9 dependencies { 10 classpath 'com.android.tools.build:gradle:0.6.+' 11 } 12 } 13 14 apply plugin: 'android' 15 16 dependencies { 17 // Add the support lib that is appropriate for SDK 4 18 compile "com.android.support:support-v4:18.0.+" 19 } 20 21 // The sample build uses multiple directories to 22 // keep boilerplate and common code separate from 23 // the main sample code. 24 List<String> dirs = [ 25 'main', // main sample code; look here for the interesting stuff. 26 'common', // components that are reused by multiple samples 27 'template'] // boilerplate code that is generated by the sample template process 28 29 android { 30 compileSdkVersion 19 31 buildToolsVersion "18.0.1" 32 33 sourceSets { 34 main { 35 dirs.each { dir -> 36 java.srcDirs "src/${dir}/java" 37 res.srcDirs "src/${dir}/res" 38 } 39 } 40 instrumentTest.setRoot('tests') 41 instrumentTest.java.srcDirs = ['tests/src'] 42 } 43 } 44 // BEGIN_EXCLUDE 45 // Tasks below this line will be hidden from release output 46 47 task preflight (dependsOn: parent.preflight) { 48 project.afterEvaluate { 49 // Inject a preflight task into each variant so we have a place to hook tasks 50 // that need to run before any of the android build tasks. 51 // 52 android.applicationVariants.each { variant -> 53 tasks.getByPath("prepare${variant.name.capitalize()}Dependencies").dependsOn preflight 54 } 55 } 56 } 57 58 // END_EXCLUDE 59