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"
}

 

posted @ 2017-03-08 21:41  冒泡的章鱼  阅读(1765)  评论(0编辑  收藏  举报