错误注释处理程序现在必须显式声明 [英] Error Annotation Processors must be explicitly declared now

查看:464
本文介绍了错误注释处理程序现在必须显式声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

突然间,我在应用程序的执行中遇到了错误。
我知道这个问题已经在这里问过了:注释处理器必须是现在显式声明



然而,解决方案并没有回答这个问题:($ / b>

这是我的build.gradle
$ b $ pre> apply plugin:'com.android.application'
apply plugin:'kotlin-android'

android {
compileSdkVersion 26
buildToolsVersion '27 .0.0'
aaptOptions {
cruncherEnabled = true
}
defaultConfig {
applicationIdcom.freelance.crdzbird_dev.clarobadge
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName1.0
testInstrumentationRunnerandroid.support。 test.runner.AndroidJUnitRunner
renderscriptTargetApi 22
renderscriptSupportModeEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'

}
packagingOptions {
不包括'META-INF / LICENSE'
不包括'META-INF / NOTICE'
}
}

依赖项{
编译fileTree(包括:''.jar'],dir:'libs')
androidTestCompile('com.android.support.test.espresso:espresso- core:2.2.2',{
exclude group:'com.android.support',module:'support-annotations'
})
compileorg.jetbrains.kotlin:kotlin- stdlib-jre7:$ kotlin_version
compile'c​​om.android.support:appcompat-v7:26.+'
compile'c​​om.android.support.constraint:constraint-layout:1.0.2'
compile'c​​om.android.support:design:26.+'
compile'c​​om.android.support:support-v4:2 6. +'
compile'c​​om.nineoldandroids:library:2.4.0'
compile'c​​om.github.javiersantos:MaterialStyledDialogs:2.1'
annotationProcessor'com.google.auto.value: auto-value:1.1'
编译'ai.api:libai:1.4.8'
编译'ai.api:sdk:2.0.7@aar'
编译'de.greenrobot: eventbus:2.4.0'
compile'io.mattcarroll.hover:hover:0.9.8'
compile'c​​om.gjiazhe:MultiChoicesCircleButton:1.0'
compileorg.apache.logging。 log4j:log4j-core:2.8
compile'c​​om.sackcentury:shinebutton:0.1.9'
compile'c​​om.yalantis:contextmenu:1.0.7'
compile'c​​om.squareup。 retrofit2:retrofit:2.3.0'
compile'c​​om.google.code.gson:gson:2.6.2'
compile'c​​om.squareup.retrofit2:converter-gson:2.1.0'
compile'c​​om.android.support:recyclerview-v7:26.0.0-alpha1'
compile'c​​om.android.support:cardview-v7:26.0.0-alpha1'
compile'c​​om。 google.androi d.gms:play-services-maps:11.0.4'
compile'c​​om.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.2'
compile'me.samthompson:bubble-actions:1.3.0'
编译'com.google.android.gms:play-services:11.0.4'
编译'com.github.apl-devs:appintro:v4.2.2'
compile'c​​om。 github.PhilJay:MPAndroidChart:v3.0.2'
compile'c​​om.google.firebase:firebase-messaging:10.2.1'
testCompile'junit:junit:4.12'
}

应用插件:'com.google.gms.google-services'
存储库{
mavenCentral()

任何人都知道如何解决这个错误。我在谷歌搜索没有成功。



这是收到的错误

 错误:任务':app:javaPreCompileDebug'的执行失败。 
>注释处理器必须现在明确声明。发现编译类路径的以下依赖包含注释处理器。请将它们添加到annotationProcessor配置中。
- log4j-core-2.8.jar(org.apache.logging.log4j:log4j-core:2.8)
或者,设置android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true以继续之前的行为。请注意,此选项已被弃用,将来会被删除。
有关更多详细信息,请参阅https://developer.android.com/r/tools/annotation-processor-error-message.html。


解决方案

该用户的错误表示此注释处理器丢失 auto-value-1.1.jar(com.google.auto.value:auto-value:1.1),答案是添加:

  annotationProcessor'com.google.auto.value:auto-value:1.1'

你的错误表示 log4j-core-2.8.jar(org.apache.logging.log4j:log4j-core:2.8)认为答案是添加这个?

  annotationProcessor'com.google.auto.value:auto-value:1.1'

您已逐字复制!当然,它不会工作!






咳嗽咳嗽咳嗽 annotationProcessor' org.apache.logging.log4j:log4j-core:2.8'


Suddenly i got an error in the execution of the app. I know that this qustion was already asked here: Annotation processors must be explicitly declared now

However the solution don't answer the problem :(

this is my build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 26
    buildToolsVersion '27.0.0'
    aaptOptions {
        cruncherEnabled = true
    }
    defaultConfig {
        applicationId "com.freelance.crdzbird_dev.clarobadge"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        renderscriptTargetApi 22
        renderscriptSupportModeEnabled true
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    compile 'com.android.support:appcompat-v7:26.+'     
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:26.+'
    compile 'com.android.support:support-v4:26.+'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.github.javiersantos:MaterialStyledDialogs:2.1'
    annotationProcessor 'com.google.auto.value:auto-value:1.1'
    compile 'ai.api:libai:1.4.8'
    compile 'ai.api:sdk:2.0.7@aar'
    compile 'de.greenrobot:eventbus:2.4.0'
    compile 'io.mattcarroll.hover:hover:0.9.8'
    compile 'com.gjiazhe:MultiChoicesCircleButton:1.0'
    compile  "org.apache.logging.log4j:log4j-core:2.8"
    compile 'com.sackcentury:shinebutton:0.1.9'
    compile 'com.yalantis:contextmenu:1.0.7'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.squareup.retrofit2:converter-gson:2.1.0'
    compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
    compile 'com.android.support:cardview-v7:26.0.0-alpha1'
    compile 'com.google.android.gms:play-services-maps:11.0.4'
    compile 'com.dlazaro66.qrcodereaderview:qrcodereaderview:2.0.2'
    compile 'me.samthompson:bubble-actions:1.3.0'
    compile 'com.google.android.gms:play-services:11.0.4'
    compile 'com.github.apl-devs:appintro:v4.2.2'
    compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
    compile 'com.google.firebase:firebase-messaging:10.2.1'
    testCompile 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'
repositories {
    mavenCentral()

Anyone knows how can this error be solved. I search in google without success.

This is the error that recieve

Error:Execution failed for task ':app: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.
    - log4j-core-2.8.jar (org.apache.logging.log4j:log4j-core:2.8)
  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.

解决方案

That user's error said this annotation processor was missing auto-value-1.1.jar (com.google.auto.value:auto-value:1.1), and the answer was to add:

annotationProcessor 'com.google.auto.value:auto-value:1.1'

Your error says log4j-core-2.8.jar (org.apache.logging.log4j:log4j-core:2.8) so you thought the answer was to add this?

annotationProcessor 'com.google.auto.value:auto-value:1.1'

You've copied it verbatim! Of course it won't work! Change the annotation processor to the one you're actually using.


Cough cough cough annotationProcessor 'org.apache.logging.log4j:log4j-core:2.8'

这篇关于错误注释处理程序现在必须显式声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆