Skip to content

Instantly share code, notes, and snippets.

@mjason
Created November 27, 2013 10:56
Show Gist options
  • Save mjason/7673896 to your computer and use it in GitHub Desktop.
Save mjason/7673896 to your computer and use it in GitHub Desktop.
androidannotations 配置例子
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
maven {
url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/"
}
}
android {
compileSdkVersion 17
buildToolsVersion "18.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}
buildTypes {
release {
runProguard true
proguardFile getDefaultProguardFile('proguard-android-optimize.txt')
}
}
productFlavors {
defaultFlavor {
proguardFile 'proguard-rules.txt'
}
}
}
ext.daggerVersion = '1.0.0';
configurations {
apt
}
dependencies {
compile 'com.google.zxing:core:2.2'
compile 'com.embarkmobile:zxing-android-minimal:1.1.4@aar'
apt files('libs/androidannotations-2.7.1.jar')
compile files('libs/androidannotations-api-2.7.1.jar')
apt "com.squareup.dagger:dagger-compiler:${daggerVersion}"
compile "com.squareup.dagger:dagger:${daggerVersion}"
}
android.applicationVariants.each { variant ->
aptOutput = file("${project.buildDir}/source/apt_generated/${variant.dirName}")
println "****************************"
println "variant: ${variant.name}"
println "manifest: ${variant.processResources.manifestFile}"
println "aptOutput: ${aptOutput}"
println "****************************"
variant.javaCompile.doFirst {
println "*** compile doFirst ${variant.name}"
aptOutput.mkdirs()
variant.javaCompile.options.compilerArgs += [
'-processorpath', configurations.apt.getAsPath(),
'-AandroidManifestFile=' + variant.processResources.manifestFile,
'-s', aptOutput
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment