lundi 26 novembre 2018

Unable to find optional library: android.test.runner

I am attempting to follow android developer documentation's Set up project for AndroidX Test tutorial (found here) but am getting the error unable to find optional library: android.test.runner.

Here is my Gradle file:

...

android {

    ...

    defaultConfig {
        ...

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    ...

    useLibrary 'android.test.runner'
    useLibrary 'android.test.base'
    useLibrary 'android.test.mock'

}

...

dependencies {
    ...

    androidTestImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:core:1.0.0'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test:rules:1.1.0'
    androidTestImplementation 'androidx.test.ext:junit:1.0.0'
    androidTestImplementation 'androidx.test.ext:truth:1.0.0'
    androidTestImplementation 'com.google.truth:truth:0.42'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
    androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
}

As you can see, I have android.test.runner in my dependencies, but when I add the line useLibrary 'android.test.runner' in my android block, I get the error that it can't find that library...

Is there something off with my Gradle file? I'm following the instructions that were outlined on the tutorial, so I don't know what I could possibly be missing...

Aucun commentaire:

Enregistrer un commentaire