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

环境: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. Tips6:用[HideInInspector]在Inspector中隐藏变量

    你曾想要把某些公有变量在Inspetor面板中隐藏起来吗,这样很简单就能做到. 让我们来看以下代码: using UnityEngine; public class HidingScript : Mo ...

  2. Android程序ToDoList增加配置项页面

    本文要做的事情就是在前面做的简单的ToDoList程序上增加一个配置项页面(Reference).这个Reference页面也非常简单: 这个ToDoList现在有两个页面,主页面能填写待办事项,然后 ...

  3. myeclipse怎么github

    myeclipse怎么github 第一步.打开myeclipse->选择项目->鼠标右键->Team->Share project,将出现如下图所示: 第二步.选择git,在 ...

  4. SQL Server中@@ROWCOUNT的用法

    SQL Server中@@ROWCOUNT返回受上一语句影响的行数,返回值类型为 int 整型. 如果行数大于 20 亿,则需要使用 ROWCOUNT_BIG. @@ROWCOUNT和@@ERROR变 ...

  5. DotNetCore跨平台~性能测试~可以放心使用了

    使用dotnetCore发布站点后,它的处理请求能力不逊色IIS等大型服务的能力,号称每秒能处理115万个请求,太牛X了也. 先看看它支持的数据库 以下主流数据库都是为支持的 Microsoft SQ ...

  6. 重新想象 Windows 8.1 Store Apps (79) - 控件增强: MediaElement, Frame

    [源码下载] 重新想象 Windows 8.1 Store Apps (79) - 控件增强: MediaElement, Frame 作者:webabcd 介绍重新想象 Windows 8.1 St ...

  7. Linux修改命令提示符(关于环境参量PS1)

    关乎环境参量的四个文件/etc/profile  /etc/bashrc ~/.bashrc  ~/.bash_profile $$$:/etc/profile:此文件为系统的每个用户设置环境信息,当 ...

  8. Angularjs,WebAPI 搭建一个简易权限管理系统 —— 系统业务与实现(三)

    目录 前言 Angularjs名词与概念 Angularjs 基本功能演示 系统业务与实现 WebAPI项目主体结构 Angularjs 前端主体结构 系统业务与实现(二) 上一章我们讲解的 Angu ...

  9. 我所了解的WEB开发(4) - 神奇的URL

    如果说WEB开发中什么最为神奇的话,我觉得这当属URL了.         URL的启蒙应该是当年的互联网冲浪(surf the Internet),记得当年的电视上宣传互联网冲浪就好似今天对大数据的 ...

  10. Android Studio使用教程(二)

    以下是本次Google I/O大会发布的IDE Android Studio使用教程第二篇: 在Android Studio使用教程(一)中简要介绍了Android Studio的基本使用,包括安装. ...