Setting Explict Annotation Processor

前端 未结 9 1210
自闭症患者
自闭症患者 2021-01-30 08:25

I am attempting to add a maven repository to my Android Studio project. When I do a Gradle project sync everything is fine. However, whenever I try to build my apk, I get this e

相关标签:
9条回答
  • 2021-01-30 09:06

    Add this in defaultConfig

    android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true

    0 讨论(0)
  • 2021-01-30 09:08

    I was with a similar error. I follow the instructions on the Google link and it works.

    try to add the follow instructions to your app gradle file:

    defaultConfig {
        applicationId "com.yourdomain.yourapp"
        minSdkVersion 17
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    
        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath = false
            }
        }
    }
    

    Attention to -> includeCompileClasspath false

    0 讨论(0)
  • 2021-01-30 09:12

    If you have dependencies on the compile classpath that include annotation processors you don't need, you can disable the error check by adding the following to your build.gradle file. Keep in mind, the annotation processors you add to the compile classpath are still not added to the processor classpath.

     android {
        ...
        defaultConfig {
            ...
            javaCompileOptions {
                annotationProcessorOptions {
                    includeCompileClasspath false
                }
            }
        }
    }
    

    If you are experiencing issues migrating to the new dependency resolution strategy, you can restore behavior to that of Android plugin 2.3.0 by setting includeCompileClasspath true. However, restoring behavior to version 2.3.0 is not recommended, and the option to do so will be removed in a future update.

    See here https://developer.android.com/r/tools/annotation-processor-error-message.html for more details

    0 讨论(0)
提交回复
热议问题