Android Studio配置中AndroidAnnotations


  今天正好得空看了下關於AndroidAnnotations這個東西,這個東西發現也算是來源於其他的三方的框架吧,具體的是什么框架已經不記得了,總之是這個東西讓我很是流連忘返,雖然當時看到這個東西很驚訝,也是恨不得趕緊就能啪進去看看究竟。

  也是由於工作原因吧,說實話我也算是個敬業的小憤青,苦於不會套路,然后一直拖延到今天。

  這里就到了我今天寫這篇博客的原因說明了,這里讓我萬分惱怒和氣憤,這東西中文版很少人寫,寫的也基本就沒法看,其次就是一片博客被N多人拷貝,我也就呵呵了。

  那么咱們開始今天的主題配置講解。

  首先是項目的build gradle文件配置見下圖:

 

 

   這里大家注意下藍色部分的幾個點哈,這里着重點名下這塊配置。

buildscript {
    repositories {
        mavenCentral()//---這里一定要注意,不是 jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0'

        // 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.8'
    }
}

 

   其次是module中build gradle的配置:

 

 

 

 

 

 上述是關於其AndroidAnnotions的在gradle中的配置

 

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

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.3"
    defaultConfig {
        applicationId "com.helloworld"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

def AAVersion = '4.1.0' // change this to your desired version, for example the latest stable: 4.1.0

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.1.0'
    testCompile 'junit:junit:4.12'

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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM