Skip to content

Instantly share code, notes, and snippets.

@JhonatasMartins
Last active August 29, 2015 14:04
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 JhonatasMartins/3b694d9308e7f535b49a to your computer and use it in GitHub Desktop.
Save JhonatasMartins/3b694d9308e7f535b49a to your computer and use it in GitHub Desktop.
Test on android using robolectric gradle config
/* After i will try doing it using another gradle test plugin for robolectric
but at moment I did work it using https://github.com/JakeWharton/gradle-android-test-plugin,
that is deprecated
*/
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.10.+'
/** config for robolectric test unit **/
classpath 'org.robolectric.gradle:gradle-android-test-plugin:0.10.+'
}
}
apply plugin: 'android'
apply plugin: 'android-test'
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
}
defaultConfig {
minSdkVersion 8
targetSdkVersion 18
versionCode 1
versionName "1.0"
}
sourceSets {
androidTest {
setRoot('src/test')
}
}
buildTypes {
release {
runProguard false
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
/** config for roboletric **/
androidTestCompile 'junit:junit:4.11'
androidTestCompile ('org.robolectric:robolectric:2.4-SNAPSHOT'){
exclude module: 'classworlds'
exclude module: 'maven-artifact'
exclude module: 'maven-artifact-manager'
exclude module: 'maven-error-diagnostics'
exclude module: 'maven-model'
exclude module: 'maven-plugin-registry'
exclude module: 'maven-profile'
exclude module: 'maven-project'
exclude module: 'maven-settings'
exclude module: 'nekohtml'
exclude module: 'plexus-container-default'
exclude module: 'plexus-interpolation'
exclude module: 'plexus-utils'
exclude module: 'wagon-file'
exclude module: 'wagon-http-lightweight'
exclude module: 'wagon-http-shared'
exclude module: 'wagon-provider-api'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment