Android studio正确配置AndroidAnnotation注解
2016-01-11 23:20
519 查看
新建一个工程,然后在外部的build.gradle配置文件添加如下代码:
buildscript { repositories { mavenCentral() } dependencies { // replace with the current version of the Android plugin classpath 'com.android.tools.build:gradle:1.5.0' // replace with the current version of the android-apt plugin classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' }
然后在app目录下有个build.gradle文件,在这文件中添加
apply plugin: 'com.android.application' apply plugin: 'android-apt' def A***ersion = '3.3.2'
apt "org.androidannotations:androidannotations:$A***ersion" compile "org.androidannotations:androidannotations-api:$A***ersion"
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' } }
最后重写编译后,就可以使用android annotation注解,通过注解可以简写很多代码。
相关文章推荐
- Android应用程序互保方案
- android studio的assets目录下存放ttf字体格式的问题
- Android Handler详细使用方法实例
- 服务器端启动AVD(Android Virtual Device)
- android 获得各个应用程序缓存大小和清除全部应用缓存
- android 异常捕获
- Android圆角矩形创建工具RoundRect类
- android的ContentProvider
- 下载、编译android4.4.4源码
- [Android]Android自定义View的实现
- Android studio 引入github工程
- android view 滑动
- Android换肤系列 Activity资源拦截与替换
- 安卓绘图的双缓冲机制(看了疯狂Android的双缓冲,自己的一点点感想)
- android开发中显示Installation failed with message INSTALL_FAILED_OLDER_SDK.
- Android 使用Gson解析数组多类型元素
- Android测试点
- android 显示系统初步总结
- Android多媒体-深入音频系列
- Android Dialog