Android Studio 配置Android Annotation

主要配置project下的build.gradle

新版的Android Studio 不像Eclipse, 它沒有Annotation Processing。

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

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        // replace with the current version of the Android plugin
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2+'
    }
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.matrix.comic.annotationtest" //your project name
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

apt {
    arguments {
        androidManifestFile variant.outputs[0].processResources.manifestFile
        resourcePackageName "com.matrix.comic.annotationtest" //your project name
    }
}
dependencies {
    apt "org.androidannotations:androidannotations:3.0+"          // add these
    compile "org.androidannotations:androidannotations-api:3.0+"  // two lines
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.0.1'
}

對比以上和自己的文件進行添加和修改。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章