I'm working on fairly large, multi module Android project which is using Data Binding, Dagger 2 and Java mixed with Kotlin.
After the slightest change in the project "code" files (.java and .kt files including activities, custom classes etc) there is a huge (up to 2 minutes) build time. It happens even when I'm adding changes like a new line or modify one character in comment.
I did run Gradle script with --info parameter and got the following hint, it "hangs" on the following task:
Build cache key for task ':AppName:kaptDebugKotlin' is 1a3a53e5f9b0934ab50a25c0133055f2 Up-to-date check for task ':AppName:kaptDebugKotlin' took 0.0 secs. It is not up-to-date because: Input property 'source' file /Users/username/Android/project-directory/AppName/build/generated/source/dataBinding/debug/android/databinding/layouts/DataBindingInfo.java has changed. Input property 'source' file /Users/username/Android/project-directory/AppName/src/main/java/com/package/to/my/activity/SomeActivity.java has changed.
The DataBindingInfo.java is generated file which contains just a buildId:
package android.databinding.layouts;
import android.databinding.BindingBuildInfo;
@BindingBuildInfo(buildId="23567c57-d3c8-4999-bc79-6211351c7d89")
public class DataBindingInfo {}
And the buildId hash changes each time there is any change in the code.
The project uses Crashlytics, I disabled it for debug builds though.
What might be the cause of this behaviour?
EDIT: buildId is getting regenerated on the project even when the Android Studio is closed and I'm doing the changes in the external editor and running builds from command line.
Reference Code generated from compiler
option? Go to Settings -> Editor -> Data Binding -> Reference Code generated from compiler -> Apply and then Restart your Android studio – Weylin