天天看點

Android Studio配置Android Annotation

Android Studio中啟用方法更加簡單,在module(不是project)中build.gradle

頂部啟用插件

apply plugin: 'android-apt'      

buildscript中添加一段:

    dependencies {

'com.android.tools.build:gradle:1.1.0'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}      

在module的build.gradle 最下方添加

dependencies {
    def AAVersion = '3.2'
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
}

apt {
    arguments {
        androidManifestFile variant.outputs[0].processResources.manifestFile
        resourcePackageName 'com.linwoain.testannotation'  //後續版本無需此句
    }
}