Skip to content

Instantly share code, notes, and snippets.

@KarlNosworthy
Last active Aug 29, 2015
Embed
What would you like to do?
A default build.gradle file for Android apps that includes dependency injection support, headless testing and mocks for CI and AssertJ to make testing sweeter.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.3'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
classpath 'org.robolectric:robolectric-gradle-plugin:0.13.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
apply plugin: 'robolectric'
apply plugin: 'com.neenbedankt.android-apt'
dependencies {
apt 'com.squareup.dagger:dagger-compiler:1.2.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.jakewharton:butterknife:5.1.2'
compile 'com.squareup.dagger:dagger:1.2.2'
provided 'com.squareup.assertj:assertj-android:1.0.0'
androidTestApt 'com.squareup.dagger:dagger-compiler:1.2.2'
androidTestCompile 'com.squareup.dagger:dagger-compiler:1.2.2'
androidTestCompile 'junit:junit:4.11'
androidTestCompile 'org.robolectric:robolectric:2.3'
androidTestCompile 'org.mockito:mockito-core:1.10.8'
}
android {
compileSdkVersion 20
buildToolsVersion "20"
defaultConfig {
minSdkVersion 15
targetSdkVersion 20
}
buildTypes {
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
quiet true
abortOnError false
}
}
robolectric {
include '**/*Test.class'
ignoreFailures true
}
@KarlNosworthy
Copy link
Author

KarlNosworthy commented Oct 14, 2014

Extended to add in Android SDK bootstrapping of required dependencies where required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment