Skip to content

Instantly share code, notes, and snippets.

@KarlNosworthy
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KarlNosworthy/ca3649e8077693bd33dd to your computer and use it in GitHub Desktop.
Save KarlNosworthy/ca3649e8077693bd33dd to your computer and use it in GitHub Desktop.
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

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