Disable incremental build for kapt

Since the android gradle plugin has enabled incremental builds by default for annotation processing, because from the annotation processors only those classes that have changed since the last incremental build will be taken into account.

So, for Java source code, we usually use the apt grald plugin to start annotation processing. However, the android gradle plugin automatically disables the incremental gradle build function if apt used in the same project: https://github.com/google/dagger/issues/298

Now I am working on a kotlin project, and Im facing the same problem of incremental build with kapt . So the solution, like apt , is to disable incremental builds. The documentation states:

 android { compileOptions.incremental = false ... } 

However, this does not work for me. Does anyone know how to disable incremental builds?

+6
source share
2 answers

You can add

 kotlin.incremental=false 

in your gradle.properties file to disable incremental building.

+1
source

I had the same problem, but it seems to be fixed in version 1.0.4. Currently it is still in the EAP phase, so you will need to add another repository.

 repositories { ... maven { url 'http://dl.bintray.com/kotlin/kotlin-dev' } } 

Then change the version to 1.0.4-eap-xx in the root build.gradle file

 buildscript { ext.kotlin_version = '1.0.4-eap-84' ... } 

Here is a link to issue .

0
source

All Articles