Disable incremental build for kapt
Asked Answered
N

2

7

Since android gradle plugin has enabled incremental build by default annotation processing breaks, because only those classes who has been changed since last incremental build will be taken into account from annotation processors.

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

Now I'm working on a kotlin project and Im facing the same incremental build issue with kapt. So the solution, as with apt, is to disable incremental build. The documentation says:

android {

  compileOptions.incremental = false
  ...
}

However, that doesn't work for me. Does anybody know how to disable incremental builds?

Neckcloth answered 20/4, 2016 at 9:53 Comment(0)
S
4

You can add

kotlin.incremental=false

to your gradle.properties file to disable the incremental building.

Simple answered 20/6, 2017 at 11:3 Comment(0)
A
0

I had the same issue but it seems to be fixed in version 1.0.4. Currently, it's still in the EAP phase so you'll have 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 your root build.gradle

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

Here's the link to the issue.

Amazon answered 22/8, 2016 at 7:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.