build.gradle & Annotation processors must be explicitly declared now

编译成功,但是运行时报错。

 Annotation processors must be explicitly declared now.  The following dependencies on the compile classpath are found to contain annotation processor.  Please add them to the annotationProcessor configuration.
    - compiler-4.7.1.jar (com.github.bumptech.glide:compiler:4.7.1)

发现:

build.gradle 中 用错了api

    api deps.glide.runtime
    api deps.glide.compiler

修改为

    api deps.glide.runtime
    kapt deps.glide.compiler

就好了。

// 附清单
def glide = [:]
glide.runtime = "com.github.bumptech.glide:glide:$versions.glide"
glide.recyclerview = "com.github.bumptech.glide:recyclerview-integration:$versions.glide"
glide.compiler = "com.github.bumptech.glide:compiler:$versions.glide"
deps.glide = glide

关于Kapt

详细报错如下:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':lib_nim:javaPreCompileDebug'.
> Annotation processors must be explicitly declared now.  The following dependencies on the compile classpath are found to contain annotation processor.  Please add them to the annotationProcessor configuration.
    - compiler-4.7.1.jar (com.github.bumptech.glide:compiler:4.7.1)
  Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior.  Note that this option is deprecated and will be removed in the future.
  See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7s

你可能感兴趣的:(build.gradle & Annotation processors must be explicitly declared now)