I have a multi module Android project. The :app: m...
# kapt
l
I have a multi module Android project. The app module is mixed Kotlin and Java. I have KAPT incremental enabled. When I add a new private function to a ViewModel class KAPT appears to process every source file in the app module despite being able to identify the changed file. Is this expected? Android Gradle Plugin: 3.5.3 Kotlin version: 1.3.61 Gradle version: 5.6 Some KAPT verbose output:
Copy code
[INFO] Kapt3 is enabled (stand-alone mode).
Annotation processing mode: apt
Memory leak detection mode: none
Show processor time: false
Verbose mode: true
Info as warnings: false
Use light analysis: false
Correct error types: false
Map diagnostic locations: false
Strict mode: false
Detect annotation processors in compile classpath: false
Incremental annotation processing (apt mode): true
Javac options: {-Xmaxerrs=500, -source=1.8}
[incremental apt] Changed files: [/path/to/file/changed/ViewModel.java] <- Correctly identifies changed file
[INFO] Processing java sources with annotation processors: [list of what looks like all source files in the app module]
Annotation processors in app module:
Copy code
dagger.internal.codegen.ComponentProcessor
dagger.android.processor.AndroidProcessor
com.squareup.inject.assisted.dagger2.processor.AssistedInjectDagger2Processor
androidx.lifecycle.LifecycleProcessor
com.squareup.moshi.kotlin.codegen.JsonClassCodegenProcessor
butterknife.compiler.ButterKnifeProcessor
android.databinding.annotationprocessor.ProcessDataBinding
com.squareup.inject.assisted.processor.AssistedInjectProcessor
There is a data module in the project which uses
moshi-kotlin-codegen
and
room-compiler
- I can see from the kapt verbose logs that changing a class in this module processes only the changed file. So the issue I’m having seems specific to the app module. I haven’t been able to find anything useful using a build scan or running gradle with --debug. Is it possible to debug the kapt plugin as it runs on the project?
I’ve also found that adding a new and unused class with no annotations triggers kapt to run again in the app module.