annotationprocessor and apt configure equivalent

与世无争的帅哥 提交于 2019-12-05 23:15:54

问题


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.

So, before...

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

and now...

dependencies {

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

回答1:


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

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


来源:https://stackoverflow.com/questions/42622060/annotationprocessor-and-apt-configure-equivalent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!