Тест инструментовки не проходит после обновления библиотек - PullRequest
0 голосов
/ 10 июля 2019

У меня есть эти зависимости gradle для всех моих инструментальных тестов:

    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'
    implementation 'androidx.test.espresso:espresso-idling-resource:3.1.0'

    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test:rules:1.1.0'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    debugImplementation 'androidx.fragment:fragment-testing:1.2.0-alpha01'
    implementation 'androidx.fragment:fragment:1.1.0-alpha01'
    androidTestImplementation 'org.mockito:mockito-android:2.24.5'

Как только я обновлю их до:

    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-intents:3.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-accessibility:3.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-web:3.2.0'
    androidTestImplementation 'androidx.test.espresso.idling:idling-concurrent:3.2.0'
    implementation 'androidx.test.espresso:espresso-idling-resource:3.2.0'

    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test:rules:1.2.0'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    debugImplementation 'androidx.fragment:fragment-testing:1.2.0-alpha01'
    implementation 'androidx.fragment:fragment:1.2.0-alpha01'
    androidTestImplementation 'org.mockito:mockito-android:2.24.5'

И запустив тест, я получаю следующую ошибку:

Не удается найти версию 'androidx.test: core', которая удовлетворяет ограничениям версии:

Путь зависимости 'my_package_name: app: unspecified' -> 'androidx.test.espresso: espresso-intets: 3.2.0 '->' androidx.test: core: 1.2.0 '

.... и так далее с множеством строк

Какрешить это?Почему это происходит?

1 Ответ

2 голосов
/ 15 июля 2019

Почему это происходит?

Это происходит из-за конфликта версий для androidx.test:core:1.2.0:

Зависимость androidx.test.espresso:espresso-intents:3.2.0 использует версию 1.2.0 базовой библиотеки. В то время как есть другая зависимость, которая использует другую версию той же библиотеки, и это делает Gradle несчастным. Если вы продолжите читать эти много строк , вы увидите, что это за другая зависимость , но я очень подозреваю, что это androidx.fragment:fragment-testing:1.2.0-alpha01, которая зависит от версии 1.1.1 базовой библиотеки.

Как решить эту проблему:

Учитывая, что вам действительно нужно обновить эспрессо, и если предположить, что проблемная библиотека тестирует фрагменты, простой обходной путь - это изменить

debugImplementation 'androidx.fragment:fragment-testing:1.2.0-alpha01'

до

debugImplementation ("androidx.fragment:fragment-testing:1.2.0-alpha01", {exclude group: 'androidx.test', module: 'core' })
...