AndroidX Junit4 测试 依赖和Android Room 的依赖

AndroidX Test 依赖

dependencies {
  // Core library
  androidTestImplementation 'androidx.test:core:1.0.0'

  // AndroidJUnitRunner and JUnit Rules
  androidTestImplementation 'androidx.test:runner:1.1.0'
  androidTestImplementation 'androidx.test:rules:1.1.0'

  // Assertions
  androidTestImplementation 'androidx.test.ext:junit:1.0.0'
  androidTestImplementation 'androidx.test.ext:truth:1.0.0'
  androidTestImplementation 'com.google.truth:truth:0.42'

  // Espresso dependencies
  androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
  androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.0'
  androidTestImplementation 'androidx.test.espresso:espresso-intents:3.1.0'
  androidTestImplementation 'androidx.test.espresso:espresso-accessibility:3.1.0'
  androidTestImplementation 'androidx.test.espresso:espresso-web:3.1.0'
  androidTestImplementation 'androidx.test.espresso.idling:idling-concurrent:3.1.0'

  // The following Espresso dependency can be either "implementation"
  // or "androidTestImplementation", depending on whether you want the
  // dependency to appear on your APK's compile classpath or the test APK
  // classpath.
  androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:3.1.0'
}

Android Room 依赖

dependencies {
    def room_version = "1.1.1"

    implementation "android.arch.persistence.room:runtime:$room_version"
    annotationProcessor "android.arch.persistence.room:compiler:$room_version" // use kapt for Kotlin

    // optional - RxJava support for Room
    implementation "android.arch.persistence.room:rxjava2:$room_version"

    // optional - Guava support for Room, including Optional and ListenableFuture
    implementation "android.arch.persistence.room:guava:$room_version"

    // Test helpers
    testImplementation "android.arch.persistence.room:testing:$room_version"
}

AndroidX Room 依赖

dependencies {
    def room_version = "2.1.0-alpha02"

    implementation "androidx.room:room-runtime:$room_version"
    annotationProcessor "androidx.room:room-compiler:$room_version" // use kapt for Kotlin

    // optional - RxJava support for Room
    implementation "androidx.room:room-rxjava2:$room_version"

    // optional - Guava support for Room, including Optional and ListenableFuture
    implementation "androidx.room:room-guava:$room_version"

    // Test helpers
    testImplementation "androidx.room:room-testing:$room_version"
}

报错

Conflict with dependency 'androidx.recyclerview:recyclerview' in project ':androidroomapplication'. Resolved versions for app (1.0.0-rc01) and test app (1.0.0) differ
dependencies {
	implementation 'androidx.recyclerview:recyclerview:1.0.0'
}

你可能感兴趣的:(Java学习笔记)