Android, Gradle: Why(second time) “gradlew build --build-cache” not finish immediately?


(Alexei) #1

Gradle ver.: 4.1.

As resuli in file in file: “/gradle/wrapper/gradle-wrapper.properties” I has the next content:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-4.1-bin.zip

Android Gradle plugin: “com.android.tools.build:gradle:2.3.3”

In my app’s build.gradle:

apply plugin: 'com.android.application’
apply plugin: 'kotlin-kapt’
apply plugin: ‘kotlin-android’

My steps for build my Android project:

  1. Start build(from command line) by: “gradlew build --build-cache

  2. Result:
    BUILD SUCCESSFUL in 6m 2s, 412 actionable tasks: 230 executed, 182 up-to-date

  3. I’m not change anything in my project

  4. Run again same command: “gradlew build --build-cache”

  5. Result:
    BUILD SUCCESSFUL in 2m 38s, 412 actionable tasks: 148 executed, 264 up-to-date

  6. I’m not change anything in my project

  7. Run again same command: “gradlew build --build-cache”

  8. Result:
    BUILD SUCCESSFUL in 1m 41s, 412 actionable tasks: 135 executed, 277 up-to-date

Questions:

  1. Why second and third time the “gradlew build --build-cache” not finish immediately?

  2. Why option “–build-cache” not help?

.


(Mark Vieira) #2

Version 2.3 of the Android Gradle plugin doesn’t yet support the build cache. Version 3.0 of this plugin however does support the cache and is currently in beta. Feel free to try it out.

https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html