AndroidAnnotations架構配置

來源:互聯網
上載者:User

標籤:

如今Android Studio的普及,Android開發基本要捨棄Eclipse了,最近使用AndroidAnnotations 註解架構的時候,找了些資料慢慢整出來了,在這給大家簡單分享一下:

首先Gradle裡面配置完全可以根據架構提供的官網學習,Gradle配置官網介紹地址:https://github.com/excilys/androidannotations/wiki/Building-Project-Gradle  在這對其進行簡單的闡述:

分三個點:首先在全域gradle檔案中添加如下資訊

buildscript {
repositories {
jcenter()
mavenCentral()      //添加maven中心倉庫
}
dependencies {
classpath ‘com.android.tools.build:gradle:1.3.0‘
classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.4‘    //  添加載入地址

}
}

repositories {
mavenCentral()        //添加maven中心倉庫
mavenLocal()          //添加本地maven倉庫
}

allprojects {
repositories {
jcenter()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

然後第二步在項目app的gradle中添加如下資訊:

apply plugin: ‘com.android.application‘
apply plugin: ‘android-apt‘  //需要添加

def AAVersion = ‘3.3.2‘    //需要添加,可根據目前的版本自訂其中的版本號碼
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"

defaultConfig {

minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android.txt‘), ‘proguard-rules.pro‘
}
}
}

dependencies {
compile fileTree(include: [‘*.jar‘], dir: ‘libs‘)
testCompile ‘junit:junit:4.12‘
compile ‘com.android.support:appcompat-v7:23.0.1‘
compile ‘com.android.support:design:23.0.1‘
apt "org.androidannotations:androidannotations:$AAVersion"      //需要添加
compile "org.androidannotations:androidannotations-api:$AAVersion"  //需要添加
}

apt {                //整個內容需要添加
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
}
}

最後構建時如果速度緩慢,需要自備FQ,之後在配置資訊清單檔中對Activity的命名進行改變,在最後面加上一個底線_,如果報錯的話就進行編譯一下就可以了!!!

最後配置就這麼完成了,該架構使用起來確實是很方便的喲~~~

 

AndroidAnnotations架構配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.