8

I have a project which is a multi-module one. I uses kotlin + dagger 2 + databindingv2. Uses the latest 3.2 android studio.

But whenever I execute incremental build by changing something in one module, some other module's (no dependency with changed module) databinding class which are generated getting changes thereby invoking kapt on that module. Thereby increasing build time.

Input property 'annotationProcessorOptionProviders$kotlin_gradle_plugin.$0.$0.buildDir' 
file /build/intermediates/data-binding/debug/compiler/dependent-lib-artifacts/
***-setter_store.bin has changed.

Has anyone faced this issue?

Is there any fix for that?

Sangeet Suresh
  • 2,527
  • 1
  • 18
  • 19
  • it's a common issue. As I understand, you need to use gradle 4.7+ to support incremental `kapt` but plugins also have to implement support for this. Dagger is not there yet – Mircea Nistor Jul 13 '18 at 19:43
  • @MirceaNistor I am using gradle 4.8. But in gradle info, I have found that modified files are from databinding only. Not from dagger. – Sangeet Suresh Jul 13 '18 at 19:44
  • 1
    Trying running your build with the --scan flag and follow the resulting link. Might give you ideas. The other commenter was also right in that not all plugins are yet set up to support incremental builds. – AutonomousApps Jul 14 '18 at 02:46
  • I am running gradle with --info. It was showing that some databinding Impl got changed. That again will triger kapt and compile for that module. – Sangeet Suresh Jul 14 '18 at 06:07
  • https://developer.android.com/studio/build/optimize-your-build official developer.android page for optimizing gradle build time – Shayan D Jul 21 '18 at 14:28
  • Just saying, latest version of Android Studio is 3.5 which has a lot of fixes and optimizations – Nick Mowen Feb 07 '20 at 19:29

1 Answers1

0

I myself have found the issue. Since there was multiple modules and modules are dependent on each other, one string resource was binded to xml using ObservableField from data binding library. That string resource was there in that module which I have changed the code. So other module which are dependent on that string resource is triggering kapt for that modules. So I remove all dependencies from all other modules. Now other tasks are not triggering.

But still I found that kapt task is not getting incremental thing. If something changes, it will triger whole kapt task for that module.

Sangeet Suresh
  • 2,527
  • 1
  • 18
  • 19