I have a problem with configuring Robolectric in my project. I am also using Kotlin, if it matters.
Here is my build.gradle
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 26
testOptions {
unitTests {
includeAndroidResources = true
}
}
sourceSets {
test.java.srcDirs += ['build/generated/source/apt/test/debug']
}
defaultConfig {
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
ext.daggerVersion = '2.11'
ext.roomVersion = '1.0.0-alpha9'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
kaptTest "com.google.dagger:dagger-compiler:$daggerVersion"
testImplementation 'junit:junit:4.12'
testImplementation "org.robolectric:robolectric:3.4.2"
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
// RxJava
implementation 'io.reactivex.rxjava2:rxjava:2.1.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
// Room
implementation "android.arch.persistence.room:runtime:$roomVersion"
implementation "android.arch.persistence.room:rxjava2:$roomVersion"
kapt "android.arch.persistence.room:compiler:$roomVersion"
compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.51"
androidTestImplementation "android.arch.persistence.room:testing:$roomVersion"
//DAGGER
implementation "com.google.dagger:dagger:$daggerVersion"
implementation "com.google.dagger:dagger-android:$daggerVersion"
implementation "com.google.dagger:dagger-android-support:$daggerVersion"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
kapt "com.google.dagger:dagger-android-processor:$daggerVersion"
//Jackson
implementation 'com.fasterxml.jackson.core:jackson-core:2.9.1'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.9.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.1'
}
repositories {
mavenCentral()
}
When i run the test, it hangs up and on the console appears message:
Downloading: org/robolectric/android-all/o-preview-4-robolectric-0/android-all-o-preview-4-robolectric-0.jar from repository sonatype at https://oss.sonatype.org/content/groups/public/ Transferring 68498K from sonatype
I was waiting for about 10-15 minutes and still nothing.
I was waiting 30 minutes till it was downloaded. I also tried this on version 3.0 - was the same issue, but downloaded slightly faster.
I made an issue here: https://github.com/robolectric/robolectric/issues/3452
Maybe there is a way to improve speed download or something.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With