注解框架AndroidAnnotations浅谈

来源:互联网 发布:个股历史pe数据查询 编辑:程序博客网 时间:2024/06/04 17:55

1、AndroidAnnotations官网:点击打开链接

2、eclipse中使用androidannotations的配置方法说明:点击打开链接

3、android studio配置androidannotations环境,我们配置的时候大概要分为下面两步

(1)在局部build.gradle中:(红色的代表需要加的)

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.+'
   apt "org.androidannotations:androidannotations:$AAVersion"
   compile "org.androidannotations:androidannotations-api:$AAVersion"

}
apt {
    arguments {

        androidManifestFile variant.outputs[0].processResources.manifestFile
        resourcePackageName '包名'
    }
}

在全局build.gradle中添加apt插件:(红色为需要加人的部分)

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
    }
}


1 0
原创粉丝点击