Create a gist now

Instantly share code, notes, and snippets.

build.gradle template for Android Gradle Plugin 0.4.2
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4.2'
}
}
project.ext {
def projectProps = new Properties()
file("project.properties").withInputStream {
stream -> projectProps.load(stream)
}
props = new ConfigSlurper().parse(projectProps)
manifest = new XmlSlurper().parse(file("AndroidManifest.xml"))
}
apply plugin: 'android'
android {
compileSdkVersion project.props.target
buildToolsVersion "17.0.0"
signingConfigs {
release {
storeFile file('release.keystore')
storePassword 'release-password'
keyAlias 'release-keyalias'
keyPassword 'release-keypassword'
}
}
buildTypes {
debug {
debuggable true
zipAlign true
}
release {
debuggable false
zipAlign true
signingConfig signingConfigs.release
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
tasks.withType(Compile) {
options.encoding = 'UTF-8'
}
task wrapper(type: Wrapper) {
gradleVersion = '1.6'
}
task copyNativeLibs(type: Copy) {
def libsDir = "$projectDir/libs"
from(libsDir) { include '**/*.so' }
into new File(buildDir, 'native-libs')
}
tasks.clean.dependsOn 'cleanCopyNativeLibs'
android.applicationVariants.each { variant ->
variant.javaCompile.dependsOn copyNativeLibs
variant.packageApplication.jniDir new File(buildDir, 'native-libs')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment