注解处理器和apt配置等效项 [英] annotationprocessor and apt configure equivalent

查看:188
本文介绍了注解处理器和apt配置等效项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用AndroidAnnotaion,但是由于Android Studio 2.3和Gradle 2.3.0,他们说android-apt已过时.而annotationProcessor是一个新的.因此,我想知道如何像以前使用apt一样配置annotationProcessor.

I'm using AndroidAnnotaion, but due to Android Studio 2.3 and Gradle 2.3.0, they said android-apt was obsoleted. And annotationProcessor is a new one. so, I want to know how can I configure annotationProcessor like I do with apt before.

如果我误会了什么,请帮忙.

If I misunderstand something, please help.

因此,在...之前

apply plugin: 'android-apt'

dependencies {

    def AAVersion = '4.2.0'
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
}

apt {
    arguments {
        library 'true'
    }
}

现在...

dependencies {

    def AAVersion = '4.2.0'
    annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
}

推荐答案

您可以通过以下方式传递注释处理配置选项:

You can pass annotation processing configuration options in the following way:

android {
  defaultConfig {
    javaCompileOptions {
      annotationProcessorOptions {
        arguments = ['library': 'true']
      }
    }
  }
}

这篇关于注解处理器和apt配置等效项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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