6
respostas

Erro de lib

Olá estou tentando criar um app para android mas recebi a seguinte mensagem de erro quando dei Rebuild no projeto.

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.
  - butterknife-5.1.2.jar (butterknife-5.1.2.jar)
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.
6 respostas

Fala ai Jayme, de boa?

Cara mostra pra gente seu build.gradle do app

Então é essa aqui:

apply plugin: 'com.android.application'

buildscript {
    repositories {
        google()
        mavenCentral()
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

android {
    compileSdkVersion 26
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "com.wakeup.xxx"
        minSdkVersion 18
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation 'com.android.support:appcompat-v7:25.1.1'
    testImplementation 'junit:junit:4.12'
    implementation 'com.jjoe64:graphview:4.2.2'
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}

eu consegui resolver o problema acima mas agora recebo amensagem:

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.

  • butterknife-5.1.2.jar (butterknife-5.1.2.jar) 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.

Acho que tu resolveu o maior problema.

Contudo tem alguns outros ai que são bem prejudiciais ao seu sistema, as várias versões que está pedindo pra usar.

ndroid {
    compileSdkVersion 26
    buildToolsVersion '28.0.3'

    defaultConfig {
        applicationId "com.wakeup.xxx"
        minSdkVersion 18
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

Como está usando o build tool na versão 28, procura deixar tudo na versão 28 e junto com isso as bibliotecas do android.

Mesmo em versionName devo mudar para "28.0"?

Version name não, essa é versão do seu app

Certo, eu mudei todos os outros version mas continuo recebendo o erro

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software