【问题标题】:Error:Execution failed for task ':app:javaPreCompileDebug'错误:任务“:app:javaPreCompileDebug”执行失败
【发布时间】:2018-12-01 05:12:00
【问题描述】:
android 
{

compileSdkVersion 27
defaultConfig 

{

applicationId "downloader.video.full.videodownloader"

minSdkVersion 15

targetSdkVersion 27

versionCode 1

versionName "1.1"

useLibrary 'org.apache.http.legacy'

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')


implementation 'com.android.support:appcompat-v7:27.1.1'

implementation 'com.android.support.constraint:constraint-layout:1.1.2'

testImplementation 'junit:junit:4.12'

androidTestImplementation 'com.android.support.test:runner:1.0.2'

androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'

implementation 'com.io.tools.android.ramiloif.folderchooser:folderchooser-
dialog:1.0.6'

implementation 'com.google.android.gms:play-services-plus:10.0.1'

implementation 'com.google.android.gms:play-services-ads:10.0.1'

implementation 'com.android.support:design:27.1.1'

implementation files('libs/json-20140107.jar')

implementation 'com.squareup.okio:okio:1.14.1'

implementation 'com.squareup.picasso:picasso:2.71828'

compile 'com.google.android.gms:play-services-analytics:10.0.1'

} 

我在构建代码时收到此错误:

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.
    - lombok-1.16.14.jar (org.projectlombok:lombok:1.16.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.

这是我的项目 gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'



        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

【问题讨论】:

  • 欢迎来到stackoverflow!最好使问题尽可能简洁易读,因此请花时间正确缩进源代码以正确显示。此外,您可能想发布您为解决问题所做的尝试,这有助于读者直接进入您的问题。
  • 您希望其他人花时间解决您的问题。因此,请您花 5 分钟时间来提出格式正确的输入。那个预览窗口,以及如何格式化输入的所有解释都是有原因的......

标签: java android lombok


【解决方案1】:
It tells you what to do...

> 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.  
      - lombok-1.16.14.jar (org.projectlombok:lombok:1.16.14)

Like so

    dependencies {

        // Other dependencies
        compileOnly "org.projectlombok:lombok:1.18.4"
        annotationProcessor 'org.projectlombok:lombok:1.18.4'
    }

[See Lombok documentation](https://projectlombok.org/setup/android)

Also, I suggest you delete `libs/json-20140107.jar` and replace it with 

    compile 'org.json:json:20140107'

Although, Android already has a JSON parser, so not clear why you need this at all

【讨论】:

    【解决方案2】:

    只需将以下几行添加到您的 Module:app gradle 文件中

    dependencies {
        compileOnly "org.projectlombok:lombok:1.18.4"
        annotationProcessor 'org.projectlombok:lombok:1.18.4'
     }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-17
      • 2018-06-06
      • 2016-02-16
      • 2017-12-18
      • 2016-06-27
      相关资源
      最近更新 更多