在Android Studio中使用androidannotations(安卓注解)的方法(通过Gradle添加)
2016-04-28 17:56
573 查看
1. 首先在project的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' } }
2. 在module的Gradle中添加:
apply plugin: 'com.android.application' apply plugin: 'android-apt' def AAVersion = '{androidannotations最新的版本}' dependencies { 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. 添加更多的AA插件:
只需将 {plugin-name} 替换为相应的插件名称即可。dependencies { apt "org.androidannotations:{plugin-name}:$AAVersion" compile "org.androidannotations:{plugin-name}-api:$AAVersion" }
参考官方文档
相关文章推荐
- SourceProvider.getJniDirectories
- 执行失败的任务 ': processDebugManifest'
- Android Studio使用教程(六):Gradle多渠道打包
- Android客户端程序Gradle如何打包
- Android Studio注释模板介绍
- Android Studio使用教程(四):Gradle基础
- Android Studio使用教程(五):Gradle命令详解和导入第三方包
- Win7安装gradle
- mac gradle 安装
- 关于Android Studio 和 Gradle的那些事儿
- Gradle这个黑盒子
- 收藏各种技术源码
- maven用户试用gradle
- 用Gradle 构建你的android程序
- 用Gradle 构建你的android程序-依赖管理篇
- Gradle 构建 android 应用常见问题解决指南
- Adnroid Studio Gradle 多渠道打包
- Gradle,构建工具的未来?
- Android Studio 使用 Gradle 打包 Jar-IT蓝豹
- Install Android Studio in Ubuntu 16.04 LTS