How to get rid of Incremental annotation processing requested warning?

后端 未结 13 932
一生所求
一生所求 2020-12-04 08:27

I have just started using android development and trying to use Room library. Since yesterday I am facing this warning message

w: [kapt] Incremental a

13条回答
  •  遥遥无期
    2020-12-04 08:50

    I'm using AndroidX, but It guess it's the same for android.arch.lifecycle. For me it simply helped replacing this:

    kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
    

    ... with this:

    implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
    

    So if you're using android.arch.lifecycle it might have the same effect replacing this:

    kapt "android.arch.lifecycle:compiler:$lifecycle_version"
    

    ... with this:

    implementation "android.arch.lifecycle:common-java8:$lifecycle_version"
    

    Be aware that this only works if you're using Java 8 and that you also should remove OnLifecycleEvent annotations for LifecycleObserver classes and let those observers implement DefaultLifecycleObserver instead.

    Changing to this method is also recommended in the build.gradle depencies shown here.

提交回复
热议问题