参考了好些配置,发现总有这样,那样的问题。

环境:androidstudio 1.5 preview 2 sdk 6.0

1.首先新建一个android项目。

过程略

2.配置project的build.gradle

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0' // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4+'
}
} allprojects {
repositories {
jcenter()
}
} task clean(type: Delete) {
delete rootProject.buildDir
}

其中红色为添加的部分,主要是使用apt插件。

3.配置module的build.gradle

apply plugin: 'com.android.application'
apply plugin: 'android-apt'
def AAVersion = '3.2+'

android {
compileSdkVersion
buildToolsVersion "23.0.2" defaultConfig {
applicationId "com.joyfulmath.myannnotationsample"
minSdkVersion
targetSdkVersion
versionCode
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
} /**
* AA注解Apt配置
*/
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 can set optional annotation processing options here, like these commented options:
// logLevel 'INFO'
// logFile '/var/log/aa.log'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"

testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
}  

红色为添加部分。

编译后,按理就可以使用annotation了。

4.使用annotation

可以百度下。

5.常见问题

错误: Could not find the AndroidManifest.xml file, going up from path

/**
* AA注解Apt配置
*/
apt {
arguments {
androidManifestFile variant.outputs[].processResources.manifestFile
// if you have multiple outputs (when using splits), you may want to have other index than // You can set optional annotation processing options here, like these commented options:
// logLevel 'INFO'
// logFile '/var/log/aa.log' }
}

如果在module下的build.gradle没有配置,就会有这个问题。

参考文档:

http://blog.csdn.net/caiwenfeng_for_23/article/details/45801151

http://apkdemo.com/gradle/

http://blog.csdn.net/wa991830558/article/details/41647781

https://github.com/excilys/androidannotations/wiki/Building-Project-Gradle

android studio annotation 配置过程的更多相关文章

  1. Android学习及开发随记1:Android Studio安装配置

    1.本系列仅为个人使用,概不负责.随着时间推移,部分内容可能因为软件更新而出现不能对应的情况. 本文的配置情况,仅针对Android Studio v1.1.0 windows版本 全新安装. Goo ...

  2. android studio+grade配置构建

    Android 构建系统编译应用资源和源代码,然后将它们打包成可供您测试.部署.签署和分发的 APK.android Studio 使用 Gradle 这一高级构建工具包来自动化执行和管理构建流程,同 ...

  3. Android Studio最新配置教程2016

    http://blog.csdn.net/wen_demo 一.Android studio 基本简单介绍 1.Android studio和Eclipse的差别: 1.Studio中有Project ...

  4. Opencv4android的Android Studio项目配置及实例下载

    因为软件竞赛的项目会用到Opencv fo rAndroid,所以就研究了一下如何在Android Studio上配置Opencv4Android 环境概述: Android Studio 2.3 O ...

  5. 浅谈Kotlin(一):简介及Android Studio中配置

    浅谈Kotlin(一):简介及Android Studio中配置 浅谈Kotlin(二):基本类型.基本语法.代码风格 浅谈Kotlin(三):类 浅谈Kotlin(四):控制流 前言: 今日新闻:谷 ...

  6. Android studio gradle配置完整版(转)

    Android studio gradle配置完整版https://my.oschina.net/u/1471093/blog/539075 Android studio 自定义打包apk名 - pe ...

  7. 使用Android Studio调试UiAutomator过程中遇到的问题

    声明: 这里纪录了个人学习和使用Android Studio调试UiAutomator过程中遇到遇到的问题,不定时进行更新,欢迎一起交流学习 1.Excution faild for task ‘:a ...

  8. Opencv4android的Android Studio环境配置及项目实例下载

    因为软件竞赛的项目会用到Opencv for Android,所以就研究了一下如何在Android Studio上配置Opencv4Android 环境概述: Android Studio 2.3 O ...

  9. Android studio在使用过程中的问题总汇!

    使用android studio也有一段时间了,汇总了一下这段时间内遇到一些常见问题,希望能够帮助到大家! 一.字体大小问题 在android studio的使用过程中没有发现类似于Eclipse中的 ...

随机推荐

  1. How can I exclude directories from grep -R?

    ‘--exclude-dir=dir’ Exclude directories matching the pattern dir from recursive directory searches. ...

  2. [编辑器]走上atom之路1

    祝大家新年快乐 我就是来卖个萌,逃- 正文 我最开始用atom是因为它看起来比较酷,我工作中主力还是使用pycharm,毕竟atom只是一个编辑器.我一 般只是用atom来写Markdown的文件.随 ...

  3. [ASP.NET]分析MVC5源码,并实现一个ASP.MVC

    本节内容不是MVC入门教程,主要讲MVC原理,实现一个和ASP.NET MVC类似基本原理的项目. MVC原理是依赖于ASP.NET管道事件基础之上的.对于这块,可阅读上节内容 [ASP.NET]谈谈 ...

  4. error LNK1281: 无法生成 SAFESEH 映像 LNK2026 模块对于 SAFESEH 映像是不安全的 VS2015 /win10

    平台 VS2015 /win10 错误 LNK1281 无法生成 SAFESEH 映像. 错误 LNK2026 模块对于 SAFESEH 映像是不安全的. 将 release 改成 debug

  5. 【WP8】扩展CM的WindowManager

    14-09-09更新:修复AppBar冲突bug 关于WindowManager,一直都很想写一篇博客分享一下,一直在忙别的,今天抽空把这个分享一下 在弹窗在移动开发是一个很常见的交互,很多时候我们都 ...

  6. 怎样在C#中从数据库中读取数据(数据读取器)

    实现在C#中通过语句,查询数据库中的数据 SqlConnection con = null; //创建SqlConnection 的对象 try    //try里面放可能出现错误的代码        ...

  7. C#方法的六种参数,值参数、引用参数、输出参数、参数数组、命名参数、可选参数

    方法的参数有六种,分别是值参数.引用参数.输出参数.参数数组.命名参数.可选参数. 值参数 值参数是方法的默认类型,通过复制实参的值到形参的方式把数据传递到方法,方法被调用时,系统作两步操作: 在栈中 ...

  8. 关于IIS寄宿WCF服务,客户端不能生成代理类

    我在使用VS2010写好WCF的Web服务后,部署在IIS7.0上,可以在IE9上进行访问,并且能显示XML数据,如下图 然后我在项目的客户端进行服务的添加引用,如下图 VS2010自动生成代理类,但 ...

  9. Winform调用QQ发信息并且开机启动 (开源)

    前言 公司CS系统需要加入启动qq从winform调用qq聊天窗口的功能,前提是需要将聊天者的QQ号码作为参数传递到函数中,一直没有搞过,正好很感兴趣,就折腾,Winform调用qq,我想肯定是需要一 ...

  10. 重大发现Discuz DB层跨库映射关系表名前缀BUG

    本文更新:http://www.cnblogs.com/x3d/p/3916198.html 场景: 在Discuz中创建Table模型,但该Table所在库与Discuz不在同一个库. Discuz ...