android studio 没有Annotation Processors 这个选项,求解答。
android studio 没有Annotation Processors 这个选项,求解答。
android studio 没有Annotation Processors 这个选项,求解答。
2015-09-10
android studio 配置
build.gradle (project)
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
//加上这句
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
build.gradle(Moudule)
apply plugin: 'android-apt'
def AAVersion = '3.2'
repositories {
mavenCentral()
mavenLocal()
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
compile 'com.android.support:appcompat-v7:22.2.0'
}
配置build.gradle就可以了。
apply plugin: 'com.android.application' apply plugin: 'android-apt' def AAVersion = '3.3.2' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "com.example.androidannotation" minSdkVersion 19 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:22.2.1' compile 'com.android.support:design:22.2.1' apt "org.androidannotations:androidannotations:$AAVersion" compile "org.androidannotations:androidannotations-api:$AAVersion" } apt { arguments { androidManifestFile variant.outputs[0].processResources.manifestFile resourcePackageName 'com.example.androidannotation' } }
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.3.0' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir }
你看着配置一下就可以了。
举报