Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find android.arch.core:core-testing:2.1.0

Tags:

android

I am getting the following error when running my tests:

Could not resolve all files for configuration ':app:debugUnitTestCompileClasspath'. Could not find android.arch.core:core-testing:2.1.0.

If it's of any help, I am using Android Studio Arctic Fox | 2020.3.1 Canary 6

Full stacktrace (screenshot, otherwise is way too long):

enter image description here

Dependencies:

    implementation Dependencies.kotlin_standard_library
    implementation Dependencies.ktx

    implementation Dependencies.appcompat
    implementation Dependencies.constraint_layout
    implementation Dependencies.material
    implementation Dependencies.lifecycle_livedata
    implementation Dependencies.lifecycle_runtime
    implementation Dependencies.lifecycle_common_java8
    implementation Dependencies.lifecycle_viewmodel

    // Hilt
    implementation Dependencies.hilt_android
    kapt AnnotationProcessing.hilt_android_compiler
    implementation Dependencies.hilt_lifecycle_viewmodel
    kapt AnnotationProcessing.hilt_compiler

    // Coroutines
    implementation Dependencies.coroutines

    // Retrofit
    implementation Dependencies.retrofit
    implementation Dependencies.converter_gson
    implementation Dependencies.logging_interceptor

    // Glide
    implementation Dependencies.glide
    kapt AnnotationProcessing.glide_compiler

    // Navigation
    implementation Dependencies.navigation_fragment
    implementation Dependencies.navigation_ktx

    // PhotoView - Zooming ImageView
    implementation Dependencies.photo_view

    // Room
    implementation Dependencies.room_runtime
    kapt AnnotationProcessing.room_compiler
    implementation Dependencies.room_ktx

    // Compose
    implementation Dependencies.compose_runtime
    implementation Dependencies.compose_ui
    implementation Dependencies.compose_foundation
    implementation Dependencies.compose_foundation_layout
    implementation Dependencies.compose_material
    implementation Dependencies.compose_runtime_livedata
    implementation Dependencies.compose_ui_tooling
    implementation Dependencies.compose_material_theme_adapter

    // Test dependencies
    androidTestImplementation AndroidTestDependencies.junit_test_ext
    androidTestImplementation AndroidTestDependencies.espresso_core

    testImplementation TestDependencies.junit
    testImplementation TestDependencies.mockito_inline
    testImplementation TestDependencies.mockito_kotlin
    testImplementation TestDependencies.core_testing
    testImplementation TestDependencies.coroutines_test

Build.kt

object Build {
    const val build_tools = "com.android.tools.build:gradle:${Versions.gradle}"
    const val kotlin_gradle_plugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}"
    const val dagger_hilt_gradle = "com.google.dagger:hilt-android-gradle-plugin:${Versions.hilt}"
    const val navigation_safe_args_gradle = "androidx.navigation:navigation-safe-args-gradle-plugin:${Versions.navigation}"
}

Dependencies.kt

object Dependencies {
    const val kotlin_standard_library = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}"
    const val ktx = "androidx.core:core-ktx:${Versions.ktx}"
    const val appcompat = "androidx.appcompat:appcompat:${Versions.appcompat}"
    const val constraint_layout = "androidx.constraintlayout:constraintlayout:${Versions.constraintlayout}"
    const val hilt_android = "com.google.dagger:hilt-android:${Versions.hilt}"
    const val hilt_lifecycle_viewmodel = "androidx.hilt:hilt-lifecycle-viewmodel:${Versions.hilt_lifecycle_viewmodel}"
    const val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutines_version}"
    const val room_runtime = "androidx.room:room-runtime:${Versions.room}"
    const val room_ktx = "androidx.room:room-ktx:${Versions.room}"
    const val retrofit = "com.squareup.retrofit2:retrofit:${Versions.retrofit2_version}"
    const val converter_gson = "com.squareup.retrofit2:converter-gson:${Versions.retrofit2_version}"
    const val logging_interceptor =
        "com.squareup.okhttp3:logging-interceptor:${Versions.okhttp_logging_interceptor}"
    const val glide = "com.github.bumptech.glide:glide:${Versions.glide_version}"
    const val material = "com.google.android.material:material:${Versions.material_design}"
    const val navigation_fragment =
        "androidx.navigation:navigation-fragment-ktx:${Versions.navigation}"
    const val navigation_ktx = "androidx.navigation:navigation-ui-ktx:${Versions.navigation}"
    const val photo_view = "com.github.chrisbanes:photoview:${Versions.photo_view}"
    const val lifecycle_livedata =
        "androidx.lifecycle:lifecycle-livedata-ktx:${Versions.lifecycle_version}"
    const val lifecycle_runtime =
        "androidx.lifecycle:lifecycle-runtime:${Versions.lifecycle_version}"
    const val lifecycle_common_java8 =
        "androidx.lifecycle:lifecycle-common-java8:${Versions.lifecycle_version}"
    const val lifecycle_viewmodel =
        "androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.lifecycle_version}"
    const val compose_runtime = "androidx.compose.runtime:runtime:${Versions.compose}"
    const val compose_ui = "androidx.compose.ui:ui:${Versions.compose}"
    const val compose_foundation = "androidx.compose.foundation:foundation:${Versions.compose}"
    const val compose_foundation_layout =
        "androidx.compose.foundation:foundation-layout:${Versions.compose}"
    const val compose_material = "androidx.compose.material:material:${Versions.compose}"
    const val compose_runtime_livedata =
        "androidx.compose.runtime:runtime-livedata:${Versions.compose}"
    const val compose_ui_tooling = "androidx.compose.ui:ui-tooling:${Versions.compose}"
    const val compose_material_theme_adapter =
        "com.google.android.material:compose-theme-adapter:${Versions.compose}"
}

TestDependencies.kt

object TestDependencies {
    const val junit = "junit:junit:${Versions.junit_4_version}"
    const val mockito_inline = "org.mockito:mockito-inline:${Versions.mockito_inline}"
    const val mockito_kotlin = "com.nhaarman.mockitokotlin2:mockito-kotlin:${Versions.mockito_kotlin}"
    const val core_testing = "android.arch.core:core-testing:${Versions.core_testing}"
    const val coroutines_test = "org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.coroutines_version}"
}

AndroidTestDependencies.k

object AndroidTestDependencies {
    const val junit_test_ext = "androidx.test.ext:junit:${Versions.androidx_test_ext}"
    const val espresso_core = "androidx.test.espresso:espresso-core:${Versions.espresso}"
    const val instrumentation_runner = "androidx.test.runner.AndroidJUnitRunner"
}

AnnotationProcessing.kt

object AnnotationProcessing {
    const val room_compiler = "androidx.room:room-compiler:${Versions.room}"
    const val hilt_compiler = "androidx.hilt:hilt-compiler:${Versions.hilt_compiler}"
    const val hilt_android_compiler = "com.google.dagger:hilt-android-compiler:${Versions.hilt}"
    const val glide_compiler = "com.github.bumptech.glide:compiler:${Versions.glide_version}"
}

Versions.kt

object Versions {
    const val gradle = "7.0.0-alpha06"
    const val compilesdk = 30
    const val minsdk = 23
    const val targetsdk = 30
    const val kotlin = "1.4.30"
    const val room = "2.2.6"
    const val appcompat = "1.2.0"
    const val ktx = "1.3.2"
    const val hilt = "2.32-alpha"
    const val hilt_compiler = "1.0.0-alpha03"
    const val hilt_lifecycle_viewmodel = "1.0.0-alpha03"
    const val constraintlayout = "2.0.2"
    const val material_design = "1.2.1"
    const val photo_view = "2.0.0"
    const val espresso = "3.3.0"
    const val coroutines_version = "1.3.9"
    const val lifecycle_version = "2.3.0"
    const val retrofit2_version = "2.9.0"
    const val okhttp_logging_interceptor = "4.9.0"
    const val glide_version = "4.11.0"
    const val navigation = "2.3.2"
    const val junit_4_version = "4.13"
    const val androidx_test_ext = "1.1.2"
    const val mockito_inline = "3.1.0"
    const val mockito_kotlin = "2.2.0"
    const val core_testing = "2.1.0"
    const val compose = "1.0.0-alpha12"
}
like image 748
Praveen P. Avatar asked Dec 22 '22 15:12

Praveen P.


1 Answers

android.arch is the namespace of pre-AndroidX Architecture Components. As you are using an AndroidX project, you need to use the androidx.arch.core version of those dependencies:

const val core_testing = "androidx.arch.core:core-testing:${Versions.core_testing}"
like image 75
ianhanniballake Avatar answered Jan 06 '23 17:01

ianhanniballake