AndroidTests прекратил сборку после добавления androidx.fragment: зависимость для тестирования фрагментов - PullRequest
2 голосов
/ 29 мая 2019

После того, как я добавил в свой проект зависимость fragment-testing:

    // Testing dependencies
    espressoVersion = '3.2.0-beta01'
    testCoreVersion = '1.1.0'
    runnerVersion = '1.1.0'
    extJunitVersion = '1.1.0'
    testRulesVersion = '1.1.0'
    fragmentVersion = '1.1.0-alpha09'
    orchestratorVersion = '1.1.0'
    uiAutomatorVersion = '2.2.0'
    junitVersion = '4.12'
    mockitoVersion = '2.7.22'
    robolectricVersion = '4.2.1'
    liveDataTestingVersion = '1.1.0'
    androidArchCoreTestingVersion = '2.0.0'

androidTestImplementation("androidx.test.espresso:espresso-core:$rootProject.ext.espressoVersion")
androidTestImplementation "androidx.test:core:$rootProject.ext.testCoreVersion"
androidTestImplementation("androidx.test:runner:$rootProject.ext.runnerVersion")
androidTestImplementation "androidx.test.ext:junit:$rootProject.ext.extJunitVersion"
androidTestUtil ("androidx.test:orchestrator:$rootProject.ext.orchestratorVersion")
androidTestImplementation("androidx.test.espresso:espresso-intents:$rootProject.ext.espressoVersion")
implementation "androidx.test.espresso:espresso-idling-resource:$rootProject.ext.espressoVersion"
androidTestImplementation "androidx.test.uiautomator:uiautomator:$rootProject.ext.uiAutomatorVersion"
testImplementation "junit:junit:$rootProject.ext.junitVersion"
androidTestImplementation("androidx.test:rules:$rootProject.ext.testRulesVersion")
// required if you want to use Mockito for unit tests
testImplementation "org.mockito:mockito-core:$rootProject.ext.mockitoVersion"
// required if you want to use Mockito for Android tests
androidTestImplementation "org.mockito:mockito-android:$rootProject.ext.mockitoVersion"
testImplementation "org.robolectric:robolectric:$rootProject.ext.robolectricVersion"
testImplementation "org.robolectric:shadows-multidex:$rootProject.ext.robolectricVersion"
// LiveData Testing utility
testImplementation "com.jraska.livedata:testing:$rootProject.ext.liveDataTestingVersion"
testImplementation "androidx.arch.core:core-testing:$rootProject.ext.androidArchCoreTestingVersion"
// Once https://issuetracker.google.com/127986458 is fixed this can be testImplementation
implementation ("androidx.fragment:fragment-testing:$rootProject.ext.fragmentVersion")

, когда я пытаюсь построить androidTests, он терпит неудачу:

FAILURE: сборка завершилась с исключением.

Что пошло не так: не удалось определить зависимости задачи ': MyApp: mergeEsmartliveDebugAndroidTestResources'.

Не удалось разрешить все зависимости задачи для конфигурации ': MyApp: esmartliveDebugAndroidTestRuntimeClasspath.Не удалось разрешить androidx.test: core: 1.1.0.Требуется: проект: MyApp проект: MyApp> androidx.test.ext: junit: 1.1.0 проект: MyApp> androidx.fragment: тестирование фрагмента: 1.1.0-alpha09 Не удается найти версию «androidx.test: core»который удовлетворяет ограничениям версии: Путь зависимости 'MyApp: unspecified' -> 'androidx.test: core: 1.1.0' Путь ограничения 'MyApp: unspecified' -> 'androidx.test: core: {строго 1.1.0}'по следующей причине: esmartliveDebugRuntimeClasspath использует версию 1.1.0 Путь зависимости' MyApp: не указано '->' androidx.test.ext: junit: 1.1.0 '->' androidx.test: core: 1.1.0 'Путь зависимости 'MyApp: не указано' -> 'androidx.test.espresso: espresso-intets: 3.2.0-beta01' -> 'androidx.test: core: 1.2.0-beta01' Путь зависимости 'MyApp: не указано'-> 'androidx.fragment: тестирование фрагмента: 1.1.0-alpha09' -> 'androidx.test: core: 1.1.0'

Не удалось разрешить androidx.test: core: {строго 1.10,0}.Требуется: project: MyApp Не удается найти версию 'androidx.test: core', которая удовлетворяет ограничениям версии: Путь зависимости 'MyApp: unspecified' -> 'androidx.test: core: 1.1.0' Путь ограничения 'MyApp:unspecified '->' androidx.test: core: {строго 1.1.0} 'по следующей причине: esmartliveDebugRuntimeClasspath использует путь зависимости версии 1.1.0' MyApp: unspecified '->' androidx.test.ext: junit:1.1.0 '->' androidx.test: core: 1.1.0 'Путь зависимости' MyApp: не указано '->' androidx.test.espresso: espresso-intets: 3.2.0-beta01 '->' androidx.test: core: 1.2.0-beta01 'Путь зависимости' MyApp: не указано '->' androidx.fragment: тестирование фрагмента: 1.1.0-alpha09 '->' androidx.test: core: 1.1.0 '

Не удалось разрешить androidx.test: monitor: 1.1.1.Требуется: project: MyApp> androidx.test.ext: junit: 1.1.0 Не удается найти версию 'androidx.test: monitor', которая удовлетворяет ограничениям версии: Путь зависимости 'MyApp: unspecified' -> 'androidx.test.ext: junit: 1.1.0 '->' androidx.test: monitor: 1.1.1 'Путь зависимости' MyApp: не указано '->' androidx.test: runner: 1.2.0-beta01 '->'androidx.test: monitor: 1.2.0-beta01 'Путь зависимости' MyApp: не указано '->' androidx.test: core: 1.2.0-beta01 '->' androidx.test: монитор: 1.2.0-beta01'

Не удалось разрешить androidx.test: core: 1.2.0-beta01.Требуется: project: MyApp> androidx.test.espresso: espresso-intets: 3.2.0-beta01 Не удается найти версию «androidx.test: core», которая удовлетворяет ограничениям версии: Путь зависимости 'MyApp: unspecified' ->'androidx.test: core: 1.1.0' Путь ограничения 'MyApp: unspecified' -> 'androidx.test: core: {строго 1.1.0}' по следующей причине: esmartliveDebugRuntimeClasspath использует версию 1.1.0 Путь зависимости 'MyApp: не указано '->' androidx.test.ext: junit: 1.1.0 '->' androidx.test: core: 1.1.0 'Путь зависимости' MyApp: не указано '->' androidx.test.espresso: espresso-intets: 3.2.0-beta01 '->' androidx.test: core: 1.2.0-beta01 'Путь зависимости' MyApp: не указано '->' androidx.fragment: фрагментное тестирование: 1.1.0-alpha09 '->' androidx.test: core: 1.1.0 '

Не удалось разрешить androidx.test: monitor: 1.2.0-beta01.Требуется: проект: MyApp> androidx.test: бегун: 1.2.0-бета01project: MyApp> androidx.test: core: 1.2.0-beta01 Невозможно найти версию «androidx.test: monitor», которая удовлетворяет ограничениям версии: Путь зависимости «MyApp: unspecified» -> 'androidx.test.ext:junit: 1.1.0 '->' androidx.test: monitor: 1.1.1 'Путь зависимости' MyApp: не указано '->' androidx.test: runner: 1.2.0-beta01 '->' androidx.test: monitor: 1.2.0-beta01 'Путь зависимости' MyApp: не указано '->' androidx.test: core: 1.2.0-beta01 '->' androidx.test: monitor: 1.2.0-beta01 '

Не знаете, как справиться с такого рода конфликтами ... У кого-нибудь есть такая же проблема?

1 Ответ

3 голосов
/ 30 июня 2019

Это быстрое решение:

implementation ("androidx.fragment:fragment-testing:1.1.0-beta01",         
   exclude group: 'androidx.test', module: 'core'
})
...