Slide 1

Slide 1 text

Deep Dive into the Android Gradle Plugin John Rodriguez

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Build phases

Slide 5

Slide 5 text

• Initialization • Configuration • Execution Build phases rootProject.name = 'cash' include ':analytics' include ':app' include ':db' include ':keypad' include ':presenters' include ':protos' include ':screens' include ':viewmodels'

Slide 6

Slide 6 text

• Initialization • Configuration • Execution Build phases Settings rootProject.name = 'cash' include ':analytics' include ':app' include ':db' include ':keypad' include ':presenters' include ':protos' include ':screens' include ':viewmodels' project project project project project project project project project

Slide 7

Slide 7 text

• Initialization • Configuration • Execution Build phases project('cash') project(':analytics') project(':db') project(':app') project(':keypad') project(':presenters') project(':protos') project(':screens') project(':viewmodels')

Slide 8

Slide 8 text

• Initialization • Configuration • Execution Build phases project('cash') project(':analytics') project(':db') project(':app') project(':keypad') project(':presenters') project(':protos') project(':screens') project(':viewmodels') > Configure project : > Configure project :analytics > Configure project :app > Configure project :db > Configure project :keypad > Configure project :presenters > Configure project :protos > Configure project :screens > Configure project :viewmodels

Slide 9

Slide 9 text

• Initialization • Configuration • Execution Build phases project('cash') project(':analytics') project(':db') project(':app') project(':keypad') project(':presenters') project(':protos') project(':screens') project(':viewmodels') > Configure project : > Configure project :db > Configure project :protos ./gradlew :db:assembleDebug —configure-on-demand

Slide 10

Slide 10 text

Configuration buildscript { repositories { google() jcenter() }d dependencies { classpath 'com.android.tools.build:gradle:3.2.1' }f }e

Slide 11

Slide 11 text

Configuration buildscript { repositories { google() jcenter() }d dependencies { classpath 'com.android.tools.build:gradle:3.2.1' classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71' classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.16' classpath 'com.squareup.sqldelight:android-gradle-plugin:1.0.0' }f }e

Slide 12

Slide 12 text

Configuration apply plugin: 'com.android.application' apply plugin: 'com.android.library'

Slide 13

Slide 13 text

class GreetingPlugin implements Plugin { @Override void apply(Project project) { }f }e

Slide 14

Slide 14 text

class GreetingPlugin implements Plugin { @Override void apply(Project project) { project.tasks.register('Greeting') { it.doLast { println 'Hello from the Greeting Plugin' }b }a }f }e

Slide 15

Slide 15 text

class GreetingPlugin implements Plugin { @Override void apply(Project project) { project.tasks.register('Greeting') { it.doLast { println 'Hello from the Greeting Plugin' }b }a }f }e project.apply plugin: GreetingPlugin

Slide 16

Slide 16 text

class GreetingPlugin implements Plugin { @Override void apply(Project project) { project.tasks.register('Greeting') { it.doLast { println 'Hello from the Greeting Plugin' }b }a }f }e apply plugin: GreetingPlugin

Slide 17

Slide 17 text

class GreetingPluginExtension { String message String greeter }a class GreetingPlugin implements Plugin { @Override void apply(Project project) { project.tasks.register('Greeting') { it.doLast { println 'Hello from the Greeting Plugin' }b }a }f }e apply plugin: GreetingPlugin

Slide 18

Slide 18 text

class GreetingPluginExtension {1 String message String greeter }a class GreetingPlugin implements Plugin {2 @Override void apply(Project project) {3 def extension = project.extensions.create('greeting', GreetingPluginExtension) project.tasks.register('Greeting') {4 it.doLast {0 println 'Hello from the Greeting Plugin' }b }a }f }e apply plugin: GreetingPlugin

Slide 19

Slide 19 text

class GreetingPluginExtension {1 String message String greeter }a class GreetingPlugin implements Plugin {2 @Override void apply(Project project) {3 def extension = project.extensions.create('greeting', GreetingPluginExtension) project.tasks.register('Greeting') {4 it.doLast {0 println "${extension.message} from ${extension.greeter}" }b }a }f }e apply plugin: GreetingPlugin

Slide 20

Slide 20 text

apply plugin: GreetingPlugin greeting { message 'Hi' greeter 'Gradle' } $ ./gradlew Greeting > Task :Greeting Hi from Gradle

Slide 21

Slide 21 text

interface Project extends ExtensionAware, PluginAware { } interface ExtensionAware { ExtensionContainer getExtensions(); } interface PluginAware { void apply(…); PluginManager getPluginManager(); }

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

class SomeTask extends DefaultTask { @OutputDirectory File getOutputDir() {…} @InputFiles List getInputFiles() {…} @TaskAction void doStuff() {…}

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

• Initialization • Configuration • Execution Build phases

Slide 30

Slide 30 text

• Initialization • Configuration • Execution Build phases ./gradlew :db:assembleDebug

Slide 31

Slide 31 text

Notifications project.tasks.whenTaskAdded {} project.beforeEvaluate {} project.afterEvaluate {} gradle.projectsEvaluated {} gradle.taskGraph.whenReady {} gradle.taskGraph.beforeTask {} gradle.taskGraph.afterTask {}

Slide 32

Slide 32 text

Debugging Builds

Slide 33

Slide 33 text

$ ./gradlew task

Slide 34

Slide 34 text

$ ./gradlew -Dorg.gradle.debug=true task

Slide 35

Slide 35 text

$ ./gradlew --no-daemon --no-build-cache —rerun-tasks / -Dorg.gradle.debug=true task

Slide 36

Slide 36 text

$ ./gradlew --no-daemon --no-build-cache —rerun-tasks / -Dorg.gradle.debug=true task To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/4.10.2/ userguide/gradle_daemon.html. > Starting Daemon

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

dependencies { compileOnly ‘com.android.tools.build:gradle:3.2.1' }

Slide 39

Slide 39 text

?

Slide 40

Slide 40 text

gradle.taskGraph.whenReady { def dot = new File(rootProject.buildDir, 'project.dot') gradle.taskGraph.allTasks.each { task -> task.taskDependencies.getDependencies(task).each { dep -> // add task -> dep to graph }a }b 'dot -Tpng -O project.dot'.execute(…) }c

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

gradle.taskGraph.whenReady { def dot = new File(rootProject.buildDir, 'project.dot') gradle.taskGraph.allTasks.each { task -> task.taskDependencies.getDependencies(task).each { dep -> // add task -> dep to graph }a }b 'dot -Tpng -O project.dot'.execute(…) }c

Slide 43

Slide 43 text

gradle.taskGraph.whenReady { def dot = new File(rootProject.buildDir, 'project.dot') gradle.taskGraph.allTasks.each { task -> task.taskDependencies.getDependencies(task).each {…}a }b 'dot -Tpng -O project.dot'.execute(…) }c

Slide 44

Slide 44 text

gradle.taskGraph.whenReady { def dot = new File(rootProject.buildDir, 'project.dot') def startTasks = gradle.startParameter.getTaskNames().join(" ") println "command: ./gradlew " + startTasks gradle.taskGraph.allTasks.each { task -> println "task: " + task.name + ", class: " + task.class.name task.taskDependencies.getDependencies(task).each {…}a }b 'dot -Tpng -O project.dot'.execute(…) }c

Slide 45

Slide 45 text

command: ./gradlew app:assembleDebug compileJava -> JavaCompile processResources -> ProcessResources classes -> DefaultTask jar -> Jar checkDebugClasspath -> AppClasspathCheckTask preBuild -> DefaultTask preDebugBuild -> AppPreBuildTask compileDebugAidl -> AidlCompile compileDebugRenderscript -> RenderscriptCompile checkDebugManifest -> CheckManifest generateDebugBuildConfig -> GenerateBuildConfig prepareLintJar -> PrepareLintJar mainApkListPersistenceDebug -> MainApkListPersistence generateDebugResValues -> GenerateResValues generateDebugResources -> DefaultTask mergeDebugResources -> MergeResources …e

Slide 46

Slide 46 text

command: ./gradlew app:assembleDebug compileJava -> JavaCompile processResources -> ProcessResources classes -> DefaultTask jar -> Jar checkDebugClasspath -> AppClasspathCheckTask preBuild -> DefaultTask preDebugBuild -> AppPreBuildTask compileDebugAidl -> AidlCompile compileDebugRenderscript -> RenderscriptCompile checkDebugManifest -> CheckManifest generateDebugBuildConfig -> GenerateBuildConfig prepareLintJar -> PrepareLintJar mainApkListPersistenceDebug -> MainApkListPersistence generateDebugResValues -> GenerateResValues generateDebugResources -> DefaultTask mergeDebugResources -> MergeResources …e

Slide 47

Slide 47 text

gradle.taskGraph.whenReady { def dot = new File(rootProject.buildDir, 'project.dot') def startTasks = gradle.startParameter.getTaskNames().join(" ") println "command: ./gradlew " + startTasks gradle.taskGraph.allTasks.each { task -> println "task: " + task.name + ", class: " + task.class.name task.taskDependencies.getDependencies(task).each {…}a }b 'dot -Tpng -O project.dot'.execute(…) }c

Slide 48

Slide 48 text

gradle.taskGraph.whenReady { def dot = new File(rootProject.buildDir, 'project.dot') def startTasks = gradle.startParameter.getTaskNames().join(" ") println "command: ./gradlew " + startTasks gradle.taskGraph.allTasks.each { task -> println "task: " + task.name + ", class: " + task.class.name println " inputs: " task.inputs.each { it.files.each { println " " + it } } println " outputs: " task.outputs.each { it.files.each { println " " + it } } task.taskDependencies.getDependencies(task).each {…}a }b 'dot -Tpng -O project.dot'.execute(…) }c

Slide 49

Slide 49 text

gradle.taskGraph

Slide 50

Slide 50 text

gradle.taskGraph.afterTask { task -> println " inputs: " task.inputs.files.each { println " " + it } println " outputs: " task.outputs.files.each { println " " + it } }

Slide 51

Slide 51 text

> Task :app:checkDebugClasspath inputs: …/gradle-3.2.1.jar …/builder-3.2.1.jar …/tracker-26.2.1.jar …/shared-26.2.1.jar …/crash-26.2.1.jar … outputs: …/app/build/intermediates/checkDebugClasspath/debug

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

buildTypes { debug { applicationIdSuffix '.debug' minifyEnabled false proguardFile file('proguard-cash.pro') proguardFile file('proguard-cash-debug.pro') } release { minifyEnabled true shrinkResources true proguardFile file('proguard-cash.pro') } }

Slide 56

Slide 56 text

productFlavors { flavorDimensions 'environment' internal { dimension 'environment' applicationId 'com.squareup.cash.beta' } production { dimension 'environment' applicationId 'com.squareup.cash' } } debug release

Slide 57

Slide 57 text

production internal release debug

Slide 58

Slide 58 text

production internal release debug internal Release

Slide 59

Slide 59 text

production internal release debug internal Release Release

Slide 60

Slide 60 text

production internal release debug internalDebug internalRelease productionDebug productionRelease release

Slide 61

Slide 61 text

Configurations

Slide 62

Slide 62 text

dependencies { implementation project(‘:api') api project(‘:db’) }a

Slide 63

Slide 63 text

dependencies { implementation project(‘:api') api project(‘:db’) kapt project(‘:dagger’) testImplementation deps.mockito }a

Slide 64

Slide 64 text

Images from https://jeroenmols.com/blog/2017/06/14/androidstudio3/

Slide 65

Slide 65 text

Images from https://jeroenmols.com/blog/2017/06/14/androidstudio3/

Slide 66

Slide 66 text

Images from https://jeroenmols.com/blog/2017/06/14/androidstudio3/

Slide 67

Slide 67 text

:app dependencies { implementation project(':api') }a

Slide 68

Slide 68 text

:app dependencies { implementation project(':api') }a :api dependencies { implementation project(':protos') implementation deps.retrofit implementation deps.rx2 }

Slide 69

Slide 69 text

:app dependencies { implementation project(':api') } :api dependencies { implementation project(':protos') implementation deps.retrofit implementation deps.rx2 }

Slide 70

Slide 70 text

:app dependencies { implementation project(':api') }a :api dependencies { implementation project(':protos') implementation deps.retrofit implementation deps.rx2 }a

Slide 71

Slide 71 text

:app dependencies { implementation project(':api') } :api dependencies { implementation project(':protos') implementation deps.retrofit implementation deps.rx2 } :protos dependencies { api deps.wire.runtime }

Slide 72

Slide 72 text

:app dependencies { implementation project(':api') } :api dependencies { api project(':protos') implementation deps.retrofit implementation deps.rx2 } :protos dependencies { api deps.wire.runtime }

Slide 73

Slide 73 text

:app dependencies { implementation project(':api') } :api dependencies { api project(':protos') implementation deps.retrofit implementation deps.rx2 } :protos dependencies { api deps.wire.runtime }

Slide 74

Slide 74 text

:app dependencies { implementation project(':api') }a :api dependencies { api project(':protos') implementation deps.retrofit api deps.rx2 }b :protos dependencies { api deps.wire.runtime }c

Slide 75

Slide 75 text

:app dependencies { implementation project(':api') } :api dependencies { api project(':protos') api deps.retrofit api deps.rx2 } :protos dependencies { api deps.wire.runtime }

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

No content

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

No content

Slide 80

Slide 80 text

class AppClasspathCheckTask extends ClasspathComparisionTask { @TaskAction void run() { compareClasspaths(); } }e

Slide 81

Slide 81 text

class AppClasspathCheckTask extends ClasspathComparisionTask { @Override void onDifferentVersionsFound(…)a{ String message = String.format( "Conflict with dependency '%1$s:%2$s' in project '%3$s'. Resolved versions for runtime classpath (%4$s) and compile classpath (%5$s) differ. This can lead to runtime crashes. To resolve this issue …\n”, …); reporter.reportWarning(EvalIssueReporter.Type.GENERIC, message); } @TaskAction void run() { compareClasspaths(); } }e

Slide 82

Slide 82 text

class AppClasspathCheckTask extends ClasspathComparisionTask { a{…} }e

Slide 83

Slide 83 text

class AppClasspathCheckTask extends ClasspathComparisionTask { a{…} static class ConfigAction TaskConfigAction { String getName() { return variantScope.getTaskName("check", "Classpath"); } @Override void execute(@NonNull AppClasspathCheckTask task) { task.setVariantName(variantScope.getFullVariantName()); task.runtimeClasspath = variantScope.getArtifactCollection(RUNTIME_CLASSPATH, …); task.compileClasspath = variantScope.getArtifactCollection(COMPILE_CLASSPATH, …); } } }e

Slide 84

Slide 84 text

No content

Slide 85

Slide 85 text

No content

Slide 86

Slide 86 text

:moduleA dependencies { api libs.retrofit implementation libs.okhttp } :moduleB dependencies { implementation libs.retrofit } :app dependencies { implementation project(':module-a') implementation project(':module-b') }

Slide 87

Slide 87 text

$ ./gradlew app:dependencies debugCompileClasspath: debug +--- project :module-a | \--- com.squareup.retrofit2:retrofit:2.3.0 | \--- com.squareup.okhttp3:okhttp:3.8.0 | \--- com.squareup.okio:okio:1.13.0 \--- project :module-b … debugRuntimeClasspath: debug +--- project :module-a | +--- com.squareup.retrofit2:retrofit:2.3.0 | | \--- com.squareup.okhttp3:okhttp:3.8.0 -> 3.9.0 | | \--- com.squareup.okio:okio:1.13.0 | \--- com.squareup.okhttp3:okhttp:3.9.0 (*) \--- project :module-b \--- com.squareup.retrofit2:retrofit:2.3.0 (*)

Slide 88

Slide 88 text

No content

Slide 89

Slide 89 text

No content

Slide 90

Slide 90 text

No content

Slide 91

Slide 91 text

No content

Slide 92

Slide 92 text

class JavaPreCompileTask extends AndroidBuilderTask { @OutputFile File getProcessorListFile() { return processorListFile; } @TaskAction void preCompile() { Set classNames = Sets.newHashSet(); classNames.addAll( convertArtifactsToNames( collectAnnotationProcessors(annotationProcessorConfiguration) )); Gson gson = new GsonBuilder().create(); try (FileWriter writer = new FileWriter(processorListFile)) { gson.toJson(classNames, writer); } } /** * Returns a List of packages in the configuration believed to

Slide 93

Slide 93 text

} } /** * Returns a List of packages in the configuration believed to * contain an annotation processor. * * We assume a package has an annotation processor if it contains the * META-INF/services/javax.annotation.processing.Processor file. */ List<…> collectAnnotationProcessors(ArtifactCollection config) {}

Slide 94

Slide 94 text

No content

Slide 95

Slide 95 text

No content

Slide 96

Slide 96 text

> Task :app:mergeDebugResources inputs: ~/.gradle/caches/…/aapt2-3.2.1-4818971-osx.jar/… …/app/build/generated/res/resValues/debug …/app/build/generated/res/rs/debug …/app/src/main/res …/app/src/debug/res outputs: …/app/build/intermediates/blame/res/debug …/app/build/generated/res/pngs/debug …/app/build/intermediates/incremental/mergeDebugResources …/app/build/intermediates/res/merged/debug

Slide 97

Slide 97 text

No content

Slide 98

Slide 98 text

No content

Slide 99

Slide 99 text

> Task :app:processDebugResources inputs: ~/.gradle/caches/…/aapt2-3.2.1-4818971-osx.jar/… …/app/build/intermediates/apk_list/…/apk-list.gson …/app/build/intermediates/res/merged/debug …/app/build/intermediates/split_list/…/split-list.gson …/app/build/intermediates/merged_manifests/…/merged outputs: …/app/build/intermediates/incremental/processDebugResources …/app/build/intermediates/processed_res/…/out …/app/build/generated/not_namespaced_r_class_sources/…/r …/app/build/intermediates/res/symbol-table…/…/package-aware-r.txt …/app/build/intermediates/symbols/debug/R.txt

Slide 100

Slide 100 text

Resource processing • Before in aapt: take all resources and outputs one binary • Now in aapt2: compile + link • converts individual resources into binary flat files • merge at the end • uses Gradle incremental check feature for compile avoidance • Improving mergeReleaseResources for libraries • avoids full merge of resources for all the transitive dependencies

Slide 101

Slide 101 text

ArtifactTransform API Request • aar -> android-manifest Internally • aar -> exploded-aar • exploded-aar -> android-manifest • Runs once, cached globally • Downloaded, transformed on demand

Slide 102

Slide 102 text

android.libraryVariants.all { variant -> def runtimeConfiguration = variant.getRuntimeConfiguration() runtimeConfiguration.getIncoming() .artifactView(new Action() { void execute(ArtifactView.ViewConfiguration config2) { config2.attributes(new Action() { void execute(AttributeContainer c) { c.attribute(Attribute.of("artifactType", String), “android-assets“) } }) } }) .artifacts.artifacts.each { result -> // This file is an asset def file = result.file }

Slide 103

Slide 103 text

android.libraryVariants.all { variant -> def runtimeConfiguration = variant.getRuntimeConfiguration() runtimeConfiguration.getIncoming() .artifactView(new Action() { void execute(ArtifactView.ViewConfiguration config2) { config2.attributes(new Action() { void execute(AttributeContainer c) { c.attribute(Attribute.of("artifactType", String), “android-assets“) } }) } }) .artifacts.artifacts.each { result -> // This file is an asset def file = result.file }

Slide 104

Slide 104 text

ArtifactTransform API “give me all the assets” Before: view = configuration.getFiles() // check if AAR (could have JARS), then find assets… After: view = configuration.getIncoming().artifactView(config -> {...}) Downstream tasks can set up their inputs as a lazy FileCollection • allowing resolution on demand during task execution, as opposed to configuration. FileCollection will only contain the assets and tasks generating them • helpful for variant-awareness by not generating extra tasks

Slide 105

Slide 105 text

• the process of transforming .class bytecode into .dex bytecode for Android
 • D8 - new dex compiler, replaces DX
 • DX takes a class,zip,jar,apk and converts to a single dex
 • When comparing with the current DX compiler, D8 compiles faster and outputs smaller .dex files, while having the same or better app runtime performance.
 • To test in 3.0, android.enableD8=true
 • Set to default in 3.1.
 Dexing

Slide 106

Slide 106 text

DX $ $ANDROID_HOME/build-tools/LATEST/dx --dex —output=out input.jar D8 Debug mode build: $ java -jar build/libs/d8.jar --output out input.jar Release mode build: $ java -jar build/libs/d8.jar --release --output out input.jar Dexing

Slide 107

Slide 107 text

• the process of transforming .class bytecode into .dex bytecode for Android
 • D8 - new dex compiler, replaces DX
 • DX takes a class,zip,jar,apk and converts to a single dex
 • When comparing with the current DX compiler, D8 compiles faster and outputs smaller .dex files, while having the same or better app runtime performance.
 • To test in 3.0, android.enableD8=true
 • Set to default in 3.1.
 Desugaring

Slide 108

Slide 108 text

• Migration from PSI to UAST as of AGP 3.0 • Jetbrains + Google • Kotlin UAST support as of AGP 3.1 • Quick fixes • Lots more detail here: • Lint to the Finish Line: https://www.youtube.com/watch?v=wFe0WZm_xm8 • Kotlin Static Analysis with Android Lint: https://www.youtube.com/watch?v=p8yX5-lPS6o Lint

Slide 109

Slide 109 text

Improving your Builds

Slide 110

Slide 110 text

enum class BooleanOption( override val propertyName: String, override val defaultValue: Boolean = false, override val status: Option.Status = Option.Status.EXPERIMENTAL, override val additionalInfo: String = "" ) : Option { ENABLE_AAPT2("android.enableAapt2", true, DeprecationReporter.DeprecationTarget.AAPT), ENABLE_BUILD_CACHE("android.enableBuildCache", true), ENABLE_PROFILE_JSON("android.enableProfileJson", false), // Used by Studio as workaround for b/71054106, b/75955471 ENABLE_SDK_DOWNLOAD("android.builder.sdkDownload", true, status = Option.Status.STABLE), ENABLE_TEST_SHARDING("android.androidTest.shardBetweenDevices"), ENABLE_DEX_ARCHIVE( "android.useDexArchive", true, aDeprecationReporter.DeprecationTarget.LEGACY_DEXER ),a

Slide 111

Slide 111 text

VERSION_CHECK_OVERRIDE_PROPERTY("android.overrideVersionCheck"), OVERRIDE_PATH_CHECK_PROPERTY("android.overridePathCheck"), ENABLE_DESUGAR( "android.enableDesugar", true, DeprecationReporter.DeprecationTarget.DESUGAR_TOOL), ENABLE_INCREMENTAL_DESUGARING( “android.enableIncrementalDesugaring", true, DeprecationReporter.DeprecationTarget.INCREMENTAL_DESUGARING), ENABLE_GRADLE_WORKERS("android.enableGradleWorkers", false), ENABLE_AAPT2_WORKER_ACTIONS( “android.enableAapt2WorkerActions", true), ENABLE_CORE_LAMBDA_STUBS( "android.enableCoreLambdaStubs", true, DeprecationReporter.DeprecationTarget.CORE_LAMBDA_STUBS), ENABLE_D8("android.enableD8", true, DeprecationReporter.DeprecationTarget.LEGACY_DEXER),

Slide 112

Slide 112 text

AndroidProject.PROPERTY_REFRESH_EXTERNAL_NATIVE_MODEL, status = Option.Status.STABLE), IDE_GENERATE_SOURCES_ONLY( AndroidProject.PROPERTY_GENERATE_SOURCES_ONLY, status = Option.Status.STABLE), ENABLE_SEPARATE_APK_RESOURCES("android.enableSeparateApkRes", true), ENABLE_EXPERIMENTAL_FEATURE_DATABINDING( "android.enableExperimentalFeatureDatabinding", false), ENABLE_SEPARATE_R_CLASS_COMPILATION( "android.enableSeparateRClassCompilation"), ENABLE_JETIFIER("android.enableJetifier", false, status = Option.Status.STABLE), USE_ANDROID_X("android.useAndroidX", false, status = Option.Status.STABLE), ENABLE_UNIT_TEST_BINARY_RESOURCES( "android.enableUnitTestBinaryResources", false), DISABLE_EARLY_MANIFEST_PARSING(

Slide 113

Slide 113 text

~/.gradle/gradle.properties org.gradle.caching=true

Slide 114

Slide 114 text

~/.gradle/gradle.properties org.gradle.caching=true …/build.gradle kapt { useBuildCache true }

Slide 115

Slide 115 text

~/.gradle/gradle.properties org.gradle.caching=true …/build.gradle kapt { useBuildCache !isCi }

Slide 116

Slide 116 text

variantFilter { }a

Slide 117

Slide 117 text

variantFilter { variant -> if (variant.flavors[0].name == 'production' && variant.buildType.name == 'debug') { variant.ignore = true } }a

Slide 118

Slide 118 text

$ ./gradlew app:assembleDebug --profile

Slide 119

Slide 119 text

No content

Slide 120

Slide 120 text

No content

Slide 121

Slide 121 text

No content

Slide 122

Slide 122 text

No content

Slide 123

Slide 123 text

No content

Slide 124

Slide 124 text

No content

Slide 125

Slide 125 text

No content

Slide 126

Slide 126 text

No content

Slide 127

Slide 127 text

No content

Slide 128

Slide 128 text

No content

Slide 129

Slide 129 text

No content

Slide 130

Slide 130 text

http://bit.ly/sdk-search-graph

Slide 131

Slide 131 text

Deep Dive into the Android Gradle Plugin @jrodbx