До недавнего времени я мог использовать roboelectric с gradle. Я постоянно получаю сообщение об ошибке Error:(6, 17) error: package org.junit does not exist
. Я не совсем уверен и немного копался в этом.
Ниже мой проект build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
}
}
Ниже мое приложение build.gradle:
repositories {
mavenCentral()
jcenter()
}
apply plugin: 'com.android.application'
android {
...
sourceSets {
androidTest.setRoot('src/test')
}
}
dependencies {
...
// Testing
compile project(':core')
testCompile 'org.robolectric:robolectric:2.4'
testCompile 'junit:junit:4.+'
testCompile 'org.easytesting:fest:1.0.16'
testCompile 'com.squareup:fest-android:1.0.8'
}
мой основной проект build.gradle:
apply plugin: 'java'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
testCompile 'org.robolectric:robolectric:2.4'
}
Я прочитал ниже об этом, и ничего здесь не сработало для меня:
https://www.bignerdranch.com/blog/all-in-together-android-studio-gradle-and-robolectric/ — подключаемый модуль студии Android, который должен использоваться, дает сбой в более новых версиях студии Android.
https://www.bignerdranch.com/blog/triumph-android-studio-1-2-sneaks-in-full-testing-support/ — это просто не решает проблему. Он не может найти org.junit.
Может ли кто-нибудь указать мне в правильном направлении для этого? Почему он не может обнаружить org.junit
из build.gradle
?