Android Databinding build fail after Gradle plugin update with migration to annotationProcessor

前端 未结 3 801
攒了一身酷
攒了一身酷 2021-01-02 05:30
  • To support Instant Run in my version of Android Studio, I needed to upgrade my Gradle plugin from version 2.2.3 to 2.3.3
3条回答
  •  走了就别回头了
    2021-01-02 05:55

    It seems it all comes down to my project using Kotlin. Actually we have it mixed: some classes use plain old Java while others are written in Kotlin. An incomplete migration. :)

    I assume that without Kotlin, replacing apt with annotationProcessor would be enough and I wouldn't have ran into this issue at all.

    Solution

    Annotations need to be processed by both annotationProcessor and kapt, which seems to be Kotlin's own annotation processor.

    For each Gradle dependency that uses annotations, you should have both of the following in your app-level build.gradle:

    • annotationProcessor 'com.example.my.library:x.y.z
    • kapt 'com.example.my.library:x.y.z

提交回复
热议问题