为了账号安全,请及时绑定邮箱和手机立即绑定

android studio 没有Annotation Processors 这个选项,求解答。

android studio 没有Annotation Processors 这个选项,求解答。

正在回答

2 回答

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

0 回复 有任何疑惑可以回复我~
#1

wb_muke

请问下为什么AndroidStudio要配置这么多啊,和平常项目不一样啊,平时一句话搞定啊。
2016-03-29 回复 有任何疑惑可以回复我~

配置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
}

你看着配置一下就可以了。

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
懒人必备之Android效率开发框架
  • 参与学习       61359    人
  • 解答问题       72    个

本教程带你学一个快捷方便的Android开发框架,敏捷开发必备

进入课程

android studio 没有Annotation Processors 这个选项,求解答。

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号