Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Understanding build.gradle

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Understanding build.gradle

Avatar for Vishnu Rajeevan

Vishnu Rajeevan

December 19, 2017
Tweet

Other Decks in Programming

Transcript

  1. build.gradle app/build.gradle buildscript { ext.kotlin_version = '1.1.51' repositories { google()

    jcenter() }A dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }B }C allprojects { repositories { google() jcenter() }D }E task clean(type: Delete) { delete rootProject.buildDir }F apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }H }I }J dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' }K
  2. build.gradle buildscript { ext.kotlin_version = '1.1.51' repositories { google() jcenter()

    }A dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }B }C allprojects { repositories { google() jcenter() }D }E task clean(type: Delete) { delete rootProject.buildDir }F
  3. build.gradle buildscript { ext.kotlin_version = '1.1.51' repositories { google() jcenter()

    }A dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }B }C
  4. build.gradle buildscript { repositories { google() jcenter() }A dependencies {

    classpath 'com.android.tools.build:gradle:3.0.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }B }C
  5. build.gradle buildscript { ext.kotlin_version = '1.1.51' repositories { google() jcenter()

    }A dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }B }C
  6. build.gradle buildscript { ext.kotlin_version = '1.1.51' repositories { google() jcenter()

    }A dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }B }C allprojects { repositories { google() jcenter() }D }E task clean(type: Delete) { delete rootProject.buildDir }F
  7. build.gradle buildscript { ext.kotlin_version = '1.1.51' repositories { google() jcenter()

    }A dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }B }C allprojects { repositories { google() jcenter() }D }E task clean(type: Delete) { delete rootProject.buildDir }F
  8. build.gradle buildscript { ext.kotlin_version = '1.1.51' repositories { google() jcenter()

    }A dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }B }C allprojects { repositories { google() jcenter() }D }E task clean(type: Delete) { delete rootProject.buildDir }F
  9. build.gradle app/build.gradle buildscript { ext.kotlin_version = '1.1.51' repositories { google()

    jcenter() }A dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }B }C allprojects { repositories { google() jcenter() }D }E task clean(type: Delete) { delete rootProject.buildDir }F apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }H }I }J dependencies1{ implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' }K
  10. app/build.gradle apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions'

    android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }H }I }J dependencies1{ implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' }K
  11. app/build.gradle apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions'

    android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }H }I }J dependencies1{ implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' }K
  12. app/build.gradle android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion

    21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.pro' }H }I }J
  13. app/build.gradle android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion

    21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.pro' }H }I }J android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.pro' }H }I }J
  14. app/build.gradle android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion

    21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.pro' }H }I }J android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.pro' }H }I }J
  15. app/build.gradle android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion

    21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.pro' }H }I }J android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.pro' }H }I }J
  16. app/build.gradle android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion

    21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.pro' }H }I }J
  17. app/build.gradle android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion

    21 targetSdkVersion 26 versionCode 1 versionName "1.0" }G }J applicationId "com.understandinggradle"t minSdkVersion 21 targetSdkVersion 26v versionCode 1r versionName "1.0"s minSdkVersion 21 minSdkVersion 21 minSdkVersion 21 minSdkVersion 21u
  18. app/build.gradle android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion

    21 targetSdkVersion 26 versionCode 1 versionName "1.0" }G }J minSdkVersion 21 minSdkVersion 21 minSdkVersion 21 minSdkVersion 21 compileSdkVersion 26 <manifest android:versionCode="1"r android:versionName="1.0"s package="com.understandinggradle">t <uses-sdk android:minSdkVersion="21"u android:targetSdkVersion="26" />v ... </manifest>
  19. app/build.gradle android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion

    21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.pro' }H }I }J
  20. app/build.gradle android { buildTypes { release { minifyEnabled true proguardFiles

    getDefaultProguardFile('proguard- android.txt'), 'proguard-rules.pro' }H }I }J
  21. app/build.gradle android { buildTypes { release { minifyEnabled true proguardFiles

    getDefaultProguardFile('proguard- android.txt'), 'proguard-rules.pro' }H debug { versionNameSuffix = "-SNAPSHOT" minifyEnabled false }1 }I }J
  22. app/build.gradle android { buildTypes { release { minifyEnabled true proguardFiles

    getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }H debug { versionNameSuffix = "-SNAPSHOT" minifyEnabled false }1 beta { versionNameSuffix = "-BETA" minifyEnabled true }2J }I }J
  23. app/build.gradle apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions'

    android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }H }I }J dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' }K
  24. app/build.gradle dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

    implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso- core:3.0.1' }K
  25. app/build.gradle dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

    implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.google.dagger:dagger:2.11' annotationProcessor 'com.google.dagger:dagger-compiler:2.11' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso- core:3.0.1' }KK
  26. app/build.gradle dependenciesX{ implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation

    'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso- core:3.0.1' }K
  27. build.gradle app/build.gradle buildscript { ext.kotlin_version = '1.1.51' repositories { google()

    jcenter() }A dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }B }C allprojects { repositories { google() jcenter() }D }E task clean(type: Delete) { delete rootProject.buildDir }F apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }H }I }J dependenciesX{ implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' }K
  28. build.gradle buildscript { ext.kotlin_version = '1.1.51' repositories { google() jcenter()

    }A dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }B }C allprojects { repositories { google() jcenter() }D }E task clean(type: Delete) { delete rootProject.buildDir }F
  29. build.gradle buildscript { ... }C allprojects { ... }E task

    clean(type: Delete) { ... }F ext { dagger = "com.google.dagger:dagger:2.11" daggerCompiler = "com.google.dagger:dagger-compiler:2.11" }L
  30. build.gradle buildscript { ... }C allprojects { ... }E task

    clean(type: Delete) { ... }F ext { String daggerVersion = "2.11" dagger = "com.google.dagger:dagger:2.11" daggerCompiler = "com.google.dagger:dagger-compiler:2.11" }L
  31. build.gradle buildscript { ... }C allprojects { ... }E task

    clean(type: Delete) { ... }F ext { String daggerVersion = "2.11" dagger = "com.google.dagger:dagger:$daggerVersion" daggerCompiler = "com.google.dagger:dagger-compiler:$daggerVersion" }L
  32. build.gradle buildscript { ext.kotlin_version = '1.1.51' repositories { google() jcenter()

    }A dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }B }C allprojects { repositories { google() jcenter() }D }E task clean(type: Delete) { delete rootProject.buildDir }F ext { String daggerVersion = "2.11" dagger = "com.google.dagger:dagger:$daggerVersion" daggerCompiler = "com.google.dagger:dagger-compiler:$daggerVersion" }L
  33. build.gradle app/build.gradle buildscript { ext.kotlin_version = '1.1.51' repositories { google()

    jcenter() }A dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }B }C allprojects { repositories { google() jcenter() }D }E task clean(type: Delete) { delete rootProject.buildDir }F ext { String daggerVersion = "2.11" dagger = "com.google.dagger:dagger:$daggerVersion" daggerCompiler = "com.google.dagger:dagger-compiler:$daggerVersion" }L apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }H }I }J dependenciesX{ implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' }K
  34. app/build.gradle apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions'

    android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }H }I }J dependenciesX{ implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' }K
  35. app/build.gradle dependenciesX{ implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation

    'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso- core:3.0.1' }K
  36. app/build.gradle dependenciesX{ implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation

    'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.google.dagger:dagger:2.11' annotationProcessor 'com.google.dagger:dagger-compiler:2.11' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso- core:3.0.1' }KK
  37. app/build.gradle dependenciesX{ implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation

    'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation rootProject.ext.dagger annotationProcessor rootProject.ext.daggerCompiler testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso- core:3.0.1' }KK
  38. app/build.gradle apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions'

    android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }H }I }J dependenciesX{ implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation rootProject.ext.dagger annotationProcessor rootProject.ext.daggerCompiler testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' }K
  39. build.gradle app/build.gradle buildscript { ext.kotlin_version = '1.1.51' repositories { google()

    jcenter() }A dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }B }C allprojects { repositories { google() jcenter() }D }E task clean(type: Delete) { delete rootProject.buildDir }F ext { String daggerVersion = "2.11" dagger = "com.google.dagger:dagger:$daggerVersion" daggerCompiler = "com.google.dagger:dagger-compiler:$daggerVersion" }L apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion 21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' }H }I }J dependenciesX{ implementation fileTree(dir: 'libs', include: ['*.jar']) implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation rootProject.ext.dagger annotationProcessor rootProject.ext.daggerCompiler testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' }K
  40. build.gradle buildscript { ext.kotlin_version = '1.1.51' repositories { google() jcenter()

    }A dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }B }C allprojects { repositories { google() jcenter() }D }E task clean(type: Delete) { delete rootProject.buildDir }F ext { String daggerVersion = "2.11" dagger = "com.google.dagger:dagger:$daggerVersion" daggerCompiler = "com.google.dagger:dagger-compiler:$daggerVersion" }L
  41. build.gradle buildscript { ... }C allprojects { ... }E task

    clean(type: Delete) { ... }F ext { ...8 }L
  42. build.gradle def constructVersionName() { def code = buildNumber() def major

    = "1" def feature = "6" def minor = "0" def suffix = code == 99999 ? "-DEV" : "" if (isCi()) { suffix = "-${getGitBranchName().replace('/', '-')}" }Z return "${major}.${feature}.${minor}.${code}${suffix}" }Y ext { ... }L
  43. build.gradle def constructVersionName() { def code = buildNumber() def major

    = "1" def feature = "6" def minor = "0" def suffix = code == 99999 ? "-DEV" : "" if (isCi()) { suffix = "-${getGitBranchName().replace('/', '-')}" }Z return "${major}.${feature}.${minor}.${code}${suffix}" }Y ext { appVersionName = constructVersionName() ... }L
  44. app/build.gradle android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion

    21 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.pro' }H }I }J
  45. app/build.gradle android { compileSdkVersion 26 defaultConfig { applicationId "com.understandinggradle" minSdkVersion

    21 targetSdkVersion 26 versionCode 1 versionName rootProject.ext.appVersionName testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" }G buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.pro' }H }I }J