[AndroidAnnotations框架]AndroidAnnotations的配置

一、在AndroidStudio下配置androidannotations

  1. 首先,准备好你的project。

  2. AndroidStudio下的androidannotations配置是比较容易的,只需要配置两个build.gradle就可以。

  3. 配置build.gradle
    ( 1 ) 我们先配置preject目录下的build.gradle
    在buildscript> dependencies>下添加

classpath'com.neenbedankt.gradle.plugins : android-apt : 1.4'

( 2 ) 然后是配置app目录下的build.gradle
1) 在apply plugin:'com.android.application'下增加一行

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'

2) 定义一个版本的常量,当前最新的版本是3.3.2

def AAVersion = '3.3.2'

3) 添加依赖

dependencies {
 apt "org.androidannotations : androidannotations : $AAVersion"
 compile "org.androidannotations : androidannotations-api : $AAVersion"
 }

4) 添加apt

apt {
    arguments {
        androidManifestFile variant.outputs[0].processResources.manifestFile
    }
 }
  1. 然后build一下project,就ok啦~

二、在eclipse下配置androidannotations

  1. 下载所需jar包。下载地址,当前最新的版本是3.3.2。解压压缩包,拿到androidannotations-api-*.jarandroidannotations-*.jar
  2. 导入jar包到工程中。androidannotations-api-*.jar放到工程的libs目录下,在工程目录下新建一个目录compile-libs,将androidannotations-*.jar放到compile-libs目录下。
  3. 配置工程。
    步骤一: Properties>Java Compiler>在Enable project specific settiongs处打勾,然后设置Compiler compliance level: 1.6

    步骤二: Properties>Java Compiler>Annotation Processing>在Enable project specific settiongs处打勾

    步骤三: Properties>Java Compiler>Annotation Processing>Factory Path>在Enable project specific settiongs处打勾,然后Add JARs->浏览工程目录,选择compile-libs目录下的androidannotations-*.jar,最后确定就可以。

  4. 然后就可以开始使用框架啦~
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值