До скоро можех да използвам 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 Studio, която ще се използва, се срива на по-новите версии на Android Studio.
https://www.bignerdranch.com/blog/triumph-android-studio-1-2-sneaks-in-full-testing-support/ - това просто не решава проблема. Не може да намери org.junit.
Може ли някой да ме насочи в правилната посока за това? Защо не може да открие org.junit
от build.gradle
?