突然间我在应用程序的执行中出错了。 我知道这个qustion已经在这里被问到:Annotation processors must be explicitly declared now
然而,解决方案没有回答这个问题:(
这是我的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()
任何人都知道如何解决这个错误。我在谷歌搜索没有成功。
这是收到的错误
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.
答案 0 :(得分:6)
该用户的错误表示此注释处理器缺少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'
答案 1 :(得分:0)