您的位置:首页 > 移动开发 > Android开发

安卓注解框架 annotation

2016-07-18 13:53 441 查看
为了提升开发效率,个人习惯,彰显NB等因素 zb成本最低的框架—annotation

特点:简单 文档齐全

菜鸟都可以上手—开发工作的入门门槛越来越低了

gradle配置

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
mavenLocal()
jcenter()
maven { url 'http://maven.oschina.net/content/groups/public/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
// 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 {
mavenLocal()
jcenter()
maven { url 'http://maven.oschina.net/content/groups/public/' }
}
}


以上是在 全局的gradle中配置的

以下是 modle gradle中配置的

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
def AAVersion = '3.3.2' // change this to your desired version, for example the latest stable: 4.0.0

android {
compileSdkVersion 23
buildToolsVersion "24.0.0"

defaultConfig {
applicationId "com.example.administrator.annotationtest"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:support-v4:23.3.0'

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

apt {
arguments {
androidManifestFile variant.outputs[0]?.processResources.manifestFile  //这句话sometimes cant find manifestFile,
//// so add resourcePackageName can solve this problem
resourcePackageName "com.example.administrator.annotationtest"
}
}


作为参考,自己仔细研究的时候再认真看,现在知道大概是怎么回事

详细参考

配置好了 环境就号多了

所有支持的注解

语法在此,也没什么好说的现在

其次 慕课网上 有个 讲解安卓框架的 提高安卓开发效率的 课程 大家可以搜一下
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  框架 android gradle