Can anyone help me figure out why my project takes...
# gradle
j
Can anyone help me figure out why my project takes so long to build? There seem to be two problems: 1. Incremental builds aren't working for kotlin. I made a dummy class containing no code that isn't referenced anywhere and if I add a line break to it then when I run ./gradlew assembleDebug every single kotlin file is recompiled. I'm basing that on the fact that according to the gradle build scan the compileDebugKotlin task takes as long as it does for a clean build. Java incremental builds seem to be working fine. The projct doesn't contain kapt, the only anotation processor is android databinding and in the gradle.properties we have:
Copy code
kotlin.caching.enabled=true
org.gradle.caching=true
android.databinding.incremental=true
2. The Kotlin compiler is just really slow. The project is about 90% Java and 10% Kotlin, but on a clean build the Kotlin compile task takes about twice as long as the java compile task. The project also has a very small pure kotlin module containing three small files, and I just noticed on the scan that the kotlin compile task for that project is taking even longer than the kotlin compile for the main app. I can't find any particularly helpful resources regarding kotlin compiler performance. If I could just see which files it was spending a lot of time on that might help.
t
try to add following flags to `gradle.properties`:
Copy code
kapt.incremental.apt=true
kotlin.parallel.tasks.in.project=true
j
The kapt incremental flag doesn't seem to make any difference (I assume because the project doesn't use kapt)
The kotlin parallel flag has reduced the kotlin compile time from ~17s to ~14s which is nice but still looks slower than it shouldbe
t
have you tried
org.gradle.parallel=true
option? (not sure if it is enabled by default)
j
Yeah I've got that
c
Kotlin compiles is slow 1.4.x should fix it It doesn't have compile avoidance: https://youtrack.jetbrains.com/oauth?state=%2Fissue%2FKT-26305 But at least it should be incremental
n
A bit late reply, but if @Jamie Taylor kotlin incremental compilation does not work, that s probably because he has enable local build cache