Issue
I need a test to run on the UI thread, so I want to use the UiThreadTest
annotation, but it's not resolving that annotation. I'm guessing I have to include a dependency in the gradle file, but I can't for the life of me figure out what it is.
@Test
@UiThreadTest
fun insertMultipleDelete() {
My module's build.gradle dependencies:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.0.0'
def nav_version = "2.3.3"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
def room_version = "2.2.6"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version"
kapt "androidx.room:room-compiler:$room_version"
testImplementation "androidx.room:room-testing:$room_version"
testImplementation 'androidx.test:core:1.3.0'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
What do I need to do to make it resolve?
Solution
Figured it out, you have to include androidTestImplementation 'androidx.test:rules:1.3.0'
in your gradle file.
Found it on some German website, thanks for the stellar documentation Google.
Answered By - Khantahr
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.