在项目中添加Android Annotions注解(基于Gradle)
1. 在build.gradle(project下)中添加对apt的依赖
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
2.在build.gradle(当前模块中)应用apt依赖,并定义AA版本
//在当前module中使用apt插件
apply plugin: 'com.neenbedankt.android-apt'
//定义变量(AA版本)
def AAVersion = '3.3.2'
3.定义对androidannotations.jar的依赖, 并交给apt插件
//定义对androidannotations.jar的依赖, 并交给apt插件
apt "org.androidannotations:androidannotations:$AAVersion"
//定义对android-api.jar的依赖, 将编译打包到apk中
compile "org.androidannotations:androidannotations-api:$AAVersion"
apt {
arguments {
androidManifestFile variant .outputs[0].processResources.manifestFile
}
}
注意:
- 请保持网络畅通
- androidannotions地址: https://github.com/excilys/androidannotations