Android Test Orchestrator not working with Android X

前端 未结 3 545
不思量自难忘°
不思量自难忘° 2021-02-13 09:21

I have recently migrated my project to use AndroidX, and have configured test orchestrator for my espresso tests on gradle using the following docs:

https://developer.an

3条回答
  •  孤街浪徒
    2021-02-13 09:38

    Anyone with Complex projects - here are my gradle changes

    repositories {
    mavenCentral()
    flatDir {
        dirs 'aars'
    }
    maven {
        url "https://maven.google.com"
    }
    google()}
    


    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    


    dependencies {
    compile 'androidx.lifecycle:lifecycle-extensions:2.0.0'
    compile 'androidx.core:core:1.0.0'
    compile 'androidx.recyclerview:recyclerview:1.0.0'
    compile 'androidx.appcompat:appcompat:1.0.0'
    implementation 'androidx.multidex:multidex:2.0.0'
    //kapt 'androidx.databinding:databinding-compiler:1.0.0'
    androidTestImplementation('androidx.test:runner:1.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    androidTestImplementation('androidx.test:rules:1.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    androidTestUtil 'androidx.test:orchestrator:1.1.0'
    implementation 'androidx.test.espresso:espresso-idling-resource:3.1.0'
    // Espresso support
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    androidTestImplementation('androidx.test.espresso:espresso-intents:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    androidTestImplementation('androidx.test.espresso:espresso-web:3.1.0', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile('androidx.room:room-runtime:2.0.0', {
        exclude group: 'com.android.support'
    })
    kapt 'androidx.room:room-compiler:2.0.0'
    compile('androidx.room:room-rxjava2:2.0.0', {
        exclude group: 'com.android.support'
    })
    testCompile('androidx.room:room-testing:2.0.0', {
        exclude group: 'com.google.code.gson'
    })
    androidTestImplementation('androidx.test.espresso:espresso-contrib:3.1.0') {
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude module: 'recyclerview-v7'
    }
    compile 'androidx.exifinterface:exifinterface:1.0.0'}
    


           classpath 'com.android.tools.build:gradle:3.4.1'
    

    rest of the errors I had to fix manually but in the end it worked

提交回复
热议问题