Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error Annotation Processors must be explicitly declared now

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.
like image 344
Luis Cardoza Bird Avatar asked Nov 03 '17 17:11

Luis Cardoza Bird


1 Answers

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'

like image 156
Michael Avatar answered Nov 14 '22 21:11

Michael