码迷,mamicode.com
首页 > 移动开发 > 详细

AndroidStudio 添加 AndroidAnnotations

时间:2014-12-30 16:33:55      阅读:452      评论:0      收藏:0      [点我收藏+]

标签:

1、添加对apt的依赖

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.2+‘
    }
}

 2、应用apt插件

apply plugin: ‘android-apt‘

 3、配置apt的参数,将com.example.package.name替换成项目名称

apt {
    arguments {
        androidManifestFile variant.processResources.manifestFile
        resourcePackageName "com.example.package.name"
    }
}

 4、添加对androidannotation的依赖

dependencies {
    apt "org.androidannotations:androidannotations:3.0+"          // add these
    compile "org.androidannotations:androidannotations-api:3.0+"  // two lines
    compile ‘com.android.support:appcompat-v7:+‘
    compile fileTree(dir: ‘libs‘, include: [‘*.jar‘])
}

 5、完整版

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.2+‘
    }
}

apply plugin: ‘android‘
apply plugin: ‘android-apt‘

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile(‘proguard-android.txt‘), ‘proguard-rules.txt‘
        }
    }
}

apt {
    arguments {
        androidManifestFile variant.processResources.manifestFile
        resourcePackageName "com.example.package.name"
    }
}

dependencies {
    apt "org.androidannotations:androidannotations:3.0+"
    compile "org.androidannotations:androidannotations-api:3.0+"
    compile ‘com.android.support:appcompat-v7:+‘
    compile fileTree(dir: ‘libs‘, include: [‘*.jar‘])
}

 来自 http://www.jayway.com/2014/02/21/androidannotations-setup-in-android-studio/

AndroidStudio 添加 AndroidAnnotations

标签:

原文地址:http://www.cnblogs.com/femaleprogramer/p/4193853.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!