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