Android Annotation processor compile error

1. Introduction

When using android studio 3+, you may encounter this problem:

2. The problem

After add some library to your gradle dependencies, click the build ,you may got this:

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.
  - groundy-compiler-1.5.jar (com.telly:groundy-compiler:1.5)
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.

As you can see, I have imported the groudy compiler, but the gradle compiler complains the error.

3. How to solve it?

Just add this line to your build.gradle:

android {
    android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
    compileSdkVersion 26
    ......
}

You can find detail android annotation processor compile problem solving documents here: