Skip to content

Instantly share code, notes, and snippets.

@Kogarasi
Forked from anonymous/gist:6826502
Created October 4, 2013 14:10
Show Gist options
  • Save Kogarasi/6826540 to your computer and use it in GitHub Desktop.
Save Kogarasi/6826540 to your computer and use it in GitHub Desktop.
buildscript {
repositories {
mavenCentral()
mavenRepo urls: 'http://twitter4j.org/maven2'
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
classpath 'com.googlecode.androidannotations:androidannotations:2.7.1'
classpath 'com.googlecode.androidannotations:androidannotations-api:2.7.1'
classpath 'com.h2database:h2:1.3.173'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
mavenRepo urls: 'http://twitter4j.org/maven2'
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 10
targetSdkVersion 10
}
}
configurations {
apt
}
dependencies {
compile 'com.android.support:support-v4:13.0.+'
compile 'com.squareup.dagger:dagger:1.1.0'
compile 'org.twitter4j:twitter4j-core:3.0.4-SNAPSHOT'
compile 'org.twitter4j:twitter4j-stream:3.0.4-SNAPSHOT'
compile 'com.h2database:h2:1.3.173'
apt 'com.squareup.dagger:dagger-compiler:1.1.0'
apt 'com.googlecode.androidannotations:androidannotations:2.7.1'
compile 'com.googlecode.androidannotations:androidannotations-api:2.7.1'
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
android.applicationVariants.all { variant ->
def aptOutput = file("${project.buildDir}/source/r/${variant.dirName}")
variant.javaCompile.doFirst {
println "*** compile doFirst ${variant.name}, aptOutput=${aptOutput}"
aptOutput.mkdirs()
// インクリメンタルビルドでエラーになるので古いファイルが存在する場合は消しておく
aptOutput.eachFileRecurse groovy.io.FileType.FILES, {
if (it.name.equals('R.java')) {
return
}
it.delete()
}
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