Я недавно заявил о написании тестовых случаев. Я использую JUnit и Barista для одного и того же.
Мое приложение успешно компилируется и работает, но когда я запускаю тестовые случаи, оно показывает следующую ошибку:
Could not determine the dependencies of task ':app:compileDebugAndroidTestJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugAndroidTestCompileClasspath'.
> Could not find org.mockito:mockito-core:3.0.6.
Required by:
project :app
> Could not find org.mockito:mockito-android:3.0.6.
Required by:
project :app
> Could not find org.mockito:mockito-core:3.0.6.
Required by:
project :app > com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0
> Could not find org.mockito:mockito-core:3.0.6.
Required by:
project :app > androidx.arch.core:core-testing:2.0.0
> Could not find org.mockito:mockito-core:3.0.6.
Required by:
project :app > org.mockito:mockito-inline:2.21.0
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Я не уверен, почему это происходит, я скучаю по одной маленькой вещи здесь.
Я пробовал все другие подобные вопросы о переполнении стека, но проблема все еще сохраняется.
Вот мой файл build.gradle уровня приложения:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'androidx.navigation.safeargs'
//Added for Epoxy
kapt {
correctErrorTypes = true
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
dataBinding {
enabled = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.example.githubdemo"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner = "com.example.githubdemo.TestRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug{}
uat{}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// ReactiveX
implementation "io.reactivex.rxjava2:rxjava:$rxjava_version"
implementation "io.reactivex.rxjava2:rxkotlin:$rxkotlin_version"
implementation "io.reactivex.rxjava2:rxandroid:$rxandroid_version"
// Rx
implementation("com.jakewharton.rxbinding2:rxbinding-kotlin:2.2.0")
implementation("com.jakewharton.rxbinding2:rxbinding-support-v4-kotlin:2.2.0")
implementation("com.jakewharton.rxbinding2:rxbinding-appcompat-v7-kotlin:2.2.0")
implementation("com.patloew.rxlocation:rxlocation:1.0.5")
androidTestImplementation 'com.squareup.rx.idler:rx2-idler:0.10.0'
// Retrofit2
implementation "com.squareup.retrofit2:retrofit:$retrofit2_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit2_version"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit2_version"
// Picasso
implementation "com.squareup.picasso:picasso:$picasso_version"
// Koin
implementation "org.koin:koin-android-viewmodel:2.0.1"
def nav_version = "2.1.0"
implementation "android.arch.navigation:navigation-fragment-ktx:$nav_version"
implementation "android.arch.navigation:navigation-ui-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
implementation "androidx.navigation:navigation-fragment:2.1.0"
implementation "androidx.navigation:navigation-ui-ktx:2.1.0"
implementation "androidx.navigation:navigation-fragment-ktx:2.1.0"
//Airbnb Epoxy
def epoxyVersion = "3.9.0"
implementation "com.airbnb.android:epoxy:$epoxyVersion"
kapt "com.airbnb.android:epoxy-processor:$epoxyVersion"
implementation "com.airbnb.android:epoxy-databinding:$epoxyVersion"
//MvRx
implementation 'com.airbnb.android:mvrx:2.0.0-alpha2'
testImplementation 'com.airbnb.android:mvrx-testing:2.0.0-alpha2'
androidTestImplementation("com.airbnb.android:mvrx-testing:2.0.0-alpha2")
// Testing Libs
androidTestImplementation('org.mockito:mockito-core:3.0.6')
androidTestImplementation('org.mockito:mockito-android:3.0.6')
androidTestImplementation('com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0')
testImplementation('org.junit.jupiter:junit-jupiter-api:5.5.2')
testImplementation('org.spekframework.spek2:spek-dsl-jvm:2.0.8')
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.5.2')
testRuntimeOnly('org.spekframework.spek2:spek-runner-junit5:2.0.8')
debugImplementation('androidx.fragment:fragment-testing:1.2.0-rc02')
androidTestImplementation('androidx.arch.core:core-testing:2.0.0')
androidTestImplementation('androidx.test.ext:junit:1.1.0')
androidTestImplementation('androidx.test:runner:1.1.0')
androidTestImplementation('androidx.test:core:1.1.0')
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.1')
androidTestImplementation('androidx.test.espresso:espresso-idling-resource:3.1.1')
androidTestImplementation('androidx.test.espresso.idling:idling-concurrent:3.2.0')
androidTestImplementation('androidx.test.espresso:espresso-contrib:3.1.1')
androidTestImplementation('androidx.test.espresso:espresso-intents:3.1.1')
androidTestImplementation('com.schibsted.spain:barista:3.2.0')
androidTestImplementation('org.opentest4j:opentest4j:1.2.0')
androidTestImplementation('com.squareup.okhttp3:mockwebserver:4.2.2')
androidTestImplementation('com.jakewharton.espresso:okhttp3-idling-resource:1.0.0')
// Koin
androidTestImplementation('org.koin:koin-test:2.0.1')
// Recyclerview Child Actions for Espresso
implementation('it.xabaras.android.espresso:recyclerview-child-actions:1.0')
//Input mask
implementation('com.redmadrobot:input-mask-android:5.0.0')
}
Вот файл build.gradle уровня моего проекта:
buildscript {
ext.kotlin_version = "1.3.61"
ext.rxjava_version = '2.2.10'
ext.rxkotlin_version = '2.4.0'
ext.rxandroid_version = '2.1.1'
ext.retrofit2_version = '2.6.2'
ext.picasso_version = '2.71828'
repositories {
google()
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com'
}
maven{
url 'https://jitpack.io'
}
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0-alpha07"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Я что-то упустил?