1、添加对apt的依赖

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2+'
}
}

2、应用apt插件

apply plugin: 'android-apt'

3、配置apt的参数,将com.example.package.name替换成项目名称

apt {
arguments {
androidManifestFile variant.processResources.manifestFile
resourcePackageName "com.example.package.name"
}
}

4、添加对androidannotation的依赖

dependencies {
apt "org.androidannotations:androidannotations:3.0+" // add these
compile "org.androidannotations:androidannotations-api:3.0+" // two lines
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}

5、完整版

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2+'
}
} apply plugin: 'android'
apply plugin: 'android-apt' android {
compileSdkVersion 19
buildToolsVersion "19.0.1" defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
} apt {
arguments {
androidManifestFile variant.processResources.manifestFile
resourcePackageName "com.example.package.name"
}
} dependencies {
apt "org.androidannotations:androidannotations:3.0+"
compile "org.androidannotations:androidannotations-api:3.0+"
compile 'com.android.support:appcompat-v7:+'
compile fileTree(dir: 'libs', include: ['*.jar'])
}

来自 http://www.jayway.com/2014/02/21/androidannotations-setup-in-android-studio/

AndroidStudio 添加 AndroidAnnotations的更多相关文章

  1. 【AndroidStudio-添加RecyclerView包】 AndroidStudio添加v7包中的RecyclerView

    关于AndroidStudio如何添加v7包中的RecyclerView? 左侧Project视图,在External Libraries下找到appcompat-v7包 右击appcompat-v7 ...

  2. AndroidStudio 添加翻译插件

    添加方式 第一步 在AndroidStudio的菜单栏里找到 File > Settings > 点击 . 第二步 点击Plugins > 在点击Marketplace 等待插件列表 ...

  3. 简单的androidStudio 添加Jar包

    感谢http://blog.csdn.net/ta893115871/article/details/46955791博主的文章, 1新建一个空项目 2在项目下添加一个新的moudle 3在该moud ...

  4. AndroidStudio 添加Selector文件,在res文件夹下添加文件夹

    在res文件夹下添加文件夹: 添加Selector文件:

  5. AndroidStudio添加依赖库

    以Gson为例 Step1:点击下图中的入口,进入ProjectStructure Step2: 在app项中选择Dependencies窗口,点击右侧的加号 Step3:在搜索框中输入gson,点击 ...

  6. AndroidStudio添加Android源码

    找了半天没找到,还是用google好啊!修改如下,打开如下的build.gradle,修改compileSdkVersion 为你下载的源码版本号. Open your sdk manager fro ...

  7. Ubuntu下命令行安装jdk,android-studio,及genymotion虚拟机来进行android开发

    安装JDK 从oracle官网下最新版的linux64位的jdk包(现在最新为jdk-8u92-linux-x64.tar.gz) 命令如下 新建文件夹-解压 sudo mkdir /usr/lib/ ...

  8. buntu下命令行安装jdk,android-studio,及genymotion虚拟机来进行android开发【转】

    本文转载自:http://www.cnblogs.com/iamhenanese/p/5491862.html 安装JDK 从oracle官网下最新版的linux64位的jdk包(现在最新为jdk-8 ...

  9. 使用Android Annotations开发

    使用Android Annotations框架gradle配置1.修改Module下的build.gradle apply plugin: 'com.android.application' appl ...

随机推荐

  1. echarts Y轴数据类型不同怎么让折线图显示差距不大

    如果希望在同一grid中展示不同数据类型的折线(1000或10%),那么展现出来的折线肯定显示差距很大,那么怎么让这两条折线显示效果差不多,在之前的项目中碰到了这个问题 每条折线对应的是不同的数据组, ...

  2. Java中的时间处理

    日期时间组件使用 java.util.Date:实现类,其对象具有时间.日期组件.java.util.Calendar:抽象类,其对象具有时间.日期组件.java.sql.Date:实现类,其对象具有 ...

  3. [Activator- HelloAkka] Define our Messages

    An Actor does not have a public API in terms of methods that you can invoke. Instead its public API ...

  4. 使用 GitHub API 进行数据分析 (Node.js)

    使用 GitHub API 进行数据分析 (Node.js) Node.js 的访问 GitHub 的 API 库,通过 npm 或者 yarn 安装: yarn add github-api 官方示 ...

  5. [转]Load ASP.NET MVC Partial Views Dynamically Using jQuery

    本文转自:http://www.binaryintellect.net/articles/218ca630-ba50-48fe-af6e-6f754b5894aa.aspx Most of the t ...

  6. 用DebuggerDisplay在Visual Studio的调试器中定制类的显示方式

    博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:用DebuggerDisplay在Visual Studio的调试器中定制类的显示方式.

  7. 使用Razor

    新建一个名称为Rezor的mvc空项目,定义一个模型内容 public class Product { //定义模型 public int ProductID { get; set; } public ...

  8. XML再深入

    XML 命名空间 XML 命名空间提供避免元素命名冲突的方法. 使用前缀来避免命名冲突 在 XML 中的命名冲突可以通过使用名称前缀从而容易地避免. 该 XML 携带某个 HTML 表格和某件家具的信 ...

  9. Csharp:asp.net CheckBoxList databind

    /// <summary> /// CheckBoxList數據源 /// 塗聚文 /// 20130705 /// /// </summary> private void s ...

  10. nodejs进阶(7)—async异步流程控制

    Async介绍 Async是一个流程控制工具包,提供了直接而强大的异步功能.基于Javascript为Node.js设计,同时也可以直接在浏览器中使用. Async提供了大约20个函数,包括常用的 m ...