We're trying to improve the build times of our multi-module Android app and we've reached the point where we tried to enable incremental KAPT annotation processing compilation.
- Android Studio version: v3.5.2
- Room version: v2.2.1
- Gradle version: v5.4.6
- Android Gradle Plugin version: v3.5.2
- Kotlin version: v1.3.50
gradle.properties:
org.gradle.daemon=true
org.gradle.caching=true
org.gradle.parallel=true
kapt.incremental.apt=true
kapt.use.worker.api=true
kapt.include.compile.classpath=false
android.databinding.incremental=true
build.gradle (inside each module that uses Room):
kapt {
arguments {
arg("room.incremental", "true")
}
}
However, while trying to benchmark the build times using gradlew assemble -scan
command, Gradle throws the following error:
warning: Current JDK version 1.8.0_201-b09 has a bug (https://bugs.openjdk.java.net/browse/JDK-8007720) that prevents Room from being incremental. Consider using JDK 11+ or the embedded JDK shipped with Android Studio 3.5+.
ANTLR Tool version 4.5.3 used for code generation does not match the current runtime version 4.7.1
[WARN] Incremental annotation processing requested, but support is disabled because the following processors are not incremental: androidx.room.RoomProcessor (DYNAMIC).
I've tried to set Open JDK 11 as the default JDK for the project in the Project Structure window, but it didn't work, it complained about it not being JDK 8. Any ideas what's wrong with this setup?
gradlew assemble -scan
from the command line make sure yourJAVA_HOME
environment variable also points to the same JDK11 you setup in Android Studio. – Interpret