Tinker注解bug

Execution failed for task ‘:app:javaPreCompileDebug’.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
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.
- tinker-android-anno-1.9.14.jar (com.tinkerpatch.tinker:tinker-android-anno:1.9.14)
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.

解决方法:
在app的build.gradle文件中添加

android {
    compileSdkVersion 28
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.tinkerdemo"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        //添加此处代码
        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath = true
            }
        }
    }
    ...

你可能感兴趣的:(Bug)