С созданным новым проектом Android Studio (пустой тип действия), если вы добавите следующие строки:
// Lifecycle/View Models
def lifecycleVersion = '2.0.0'
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycleVersion"
annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycleVersion"
// Core testing
def coreTestingVersion = '2.0.1'
testImplementation "androidx.arch.core:core-testing:$coreTestingVersion"
androidTestImplementation "androidx.arch.core:core-testing:$coreTestingVersion"
В файле build.gradle
приложения вы увидите ошибки при попытке запустить задачу connectedCheck
для проекта. Смотрите вывод:
Zachs-MBP:CoreTestingVersionExample Zach$ ./gradlew connectedCheck
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugAndroidTestBuild'.
> Could not resolve all task dependencies for configuration ':app:debugAndroidTestRuntimeClasspath'.
> Could not resolve androidx.arch.core:core-common:2.0.0.
Required by:
project :app
> Cannot find a version of 'androidx.arch.core:core-common' that satisfies the version constraints:
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.arch.core:core-common:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-testing:2.0.1' --> 'androidx.arch.core:core-runtime:2.0.1' --> 'androidx.arch.core:core-common:2.0.1'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata:2.0.0' --> 'androidx.arch.core:core-common:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.lifecycle:lifecycle-runtime:2.1.0-alpha03' --> 'androidx.arch.core:core-common:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata-core:2.0.0' --> 'androidx.arch.core:core-common:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.appcompat:appcompat:1.1.0-alpha03' --> 'androidx.fragment:fragment:1.1.0-alpha05' --> 'androidx.activity:activity:1.0.0-alpha05' --> 'androidx.savedstate:savedstate:1.0.0-alpha02' --> 'androidx.arch.core:core-common:2.0.0'
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-common' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-common' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-common' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-common' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-common' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
> Could not resolve androidx.arch.core:core-runtime:2.0.0.
Required by:
project :app
> Cannot find a version of 'androidx.arch.core:core-runtime' that satisfies the version constraints:
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-testing:2.0.1' --> 'androidx.arch.core:core-runtime:2.0.1'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.arch.core:core-runtime:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata:2.0.0' --> 'androidx.arch.core:core-runtime:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata-core:2.0.0' --> 'androidx.arch.core:core-runtime:2.0.0'
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-runtime' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-runtime' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-runtime' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-runtime' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-runtime' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
> Could not resolve androidx.arch.core:core-runtime:2.0.1.
Required by:
project :app > androidx.arch.core:core-testing:2.0.1
> Cannot find a version of 'androidx.arch.core:core-runtime' that satisfies the version constraints:
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-testing:2.0.1' --> 'androidx.arch.core:core-runtime:2.0.1'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.arch.core:core-runtime:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata:2.0.0' --> 'androidx.arch.core:core-runtime:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata-core:2.0.0' --> 'androidx.arch.core:core-runtime:2.0.0'
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-runtime' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-runtime' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-runtime' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-runtime' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-runtime' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
> Could not resolve androidx.arch.core:core-common:2.0.0.
Required by:
project :app > androidx.lifecycle:lifecycle-extensions:2.0.0
project :app > androidx.lifecycle:lifecycle-livedata:2.0.0
project :app > androidx.lifecycle:lifecycle-runtime:2.1.0-alpha03
project :app > androidx.lifecycle:lifecycle-livedata-core:2.0.0
project :app > androidx.savedstate:savedstate:1.0.0-alpha02
> Cannot find a version of 'androidx.arch.core:core-common' that satisfies the version constraints:
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.arch.core:core-common:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-testing:2.0.1' --> 'androidx.arch.core:core-runtime:2.0.1' --> 'androidx.arch.core:core-common:2.0.1'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata:2.0.0' --> 'androidx.arch.core:core-common:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.lifecycle:lifecycle-runtime:2.1.0-alpha03' --> 'androidx.arch.core:core-common:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata-core:2.0.0' --> 'androidx.arch.core:core-common:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.appcompat:appcompat:1.1.0-alpha03' --> 'androidx.fragment:fragment:1.1.0-alpha05' --> 'androidx.activity:activity:1.0.0-alpha05' --> 'androidx.savedstate:savedstate:1.0.0-alpha02' --> 'androidx.arch.core:core-common:2.0.0'
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-common' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-common' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-common' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-common' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-common' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
> Could not resolve androidx.arch.core:core-runtime:2.0.0.
Required by:
project :app > androidx.lifecycle:lifecycle-extensions:2.0.0
project :app > androidx.lifecycle:lifecycle-livedata:2.0.0
project :app > androidx.lifecycle:lifecycle-livedata-core:2.0.0
> Cannot find a version of 'androidx.arch.core:core-runtime' that satisfies the version constraints:
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-testing:2.0.1' --> 'androidx.arch.core:core-runtime:2.0.1'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.arch.core:core-runtime:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata:2.0.0' --> 'androidx.arch.core:core-runtime:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata-core:2.0.0' --> 'androidx.arch.core:core-runtime:2.0.0'
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-runtime' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-runtime' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-runtime' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-runtime' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-runtime' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
> Could not resolve androidx.arch.core:core-common:2.0.1.
Required by:
project :app > androidx.arch.core:core-runtime:2.0.1
> Cannot find a version of 'androidx.arch.core:core-common' that satisfies the version constraints:
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.arch.core:core-common:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-testing:2.0.1' --> 'androidx.arch.core:core-runtime:2.0.1' --> 'androidx.arch.core:core-common:2.0.1'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata:2.0.0' --> 'androidx.arch.core:core-common:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.lifecycle:lifecycle-runtime:2.1.0-alpha03' --> 'androidx.arch.core:core-common:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.lifecycle:lifecycle-extensions:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata:2.0.0' --> 'androidx.lifecycle:lifecycle-livedata-core:2.0.0' --> 'androidx.arch.core:core-common:2.0.0'
Dependency path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.appcompat:appcompat:1.1.0-alpha03' --> 'androidx.fragment:fragment:1.1.0-alpha05' --> 'androidx.activity:activity:1.0.0-alpha05' --> 'androidx.savedstate:savedstate:1.0.0-alpha02' --> 'androidx.arch.core:core-common:2.0.0'
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-common' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-common' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-common' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-common' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
Constraint path 'CoreTestingVersionExample:app:unspecified' --> 'androidx.arch.core:core-common' strictly '2.0.0' because of the following reason: debugRuntimeClasspath uses version 2.0.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Если я использую одно и то же значение lifecycleVersion
и coreTestingVersion
(например, 2.0.0), ошибки не возникают, но Линт жалуется на то, что в ядре для тестирования ядра установлена обновленная версия (2.0.1). (По крайней мере, он работает, хотя: P) Я думал, что одним из преимуществ androidx
было то, что он позволял бы обновлять отдельные части без проблем?
Вот пример приложения, показывающего проблему: https://github.com/ZOlbrys/CoreTestingVersionExample
Просто запустите connectedCheck
через терминал в этом проекте, чтобы увидеть сбой сборки.
Есть идеи, как это исправить?
edit: для этого создана проблема Google, см. https://issuetracker.google.com/issues/129316035