关于Android Studio 怎么配置Android Annotation的教程
首先说明一点,配置Android Annotation不需要下载任何文件,不同于eclipse的要下载.jar包
1、在project的build.gradle配置
2、在你创建的module的build.gradle配置
相关代码:
apply plugin: 'android-apt'
def AAVersion = '3.3.2'
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
apt {
arguments {
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
// if you have multiple outputs (when using splits), you may want to have other index than 0
// you should set your package name here if you are using different application IDs
// resourcePackageName "your.package.name"
// You can set optional annotation processing options here, like these commented options:
// logLevel 'INFO'
// logFile '/var/log/aa.log'
}
}
3、在AndroidMainfest.xml中修改MainActivity文件,在后面加"_" 下划线
这是我花了2个小时琢磨出来的经验,大家也可参考官网的配置方式
https://github.com/excilys/androidannotations/wiki/Building-Project-Gradle

浙公网安备 33010602011771号