找不到满足版本限制的'androidx.arch.core:core-common'版本 [英] Cannot find a version of 'androidx.arch.core:core-common' that satisfies the version constraints

查看:320
本文介绍了找不到满足版本限制的'androidx.arch.core:core-common'版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果添加以下行,则创建新的Android Studio项目(空活动"类型):

With a new Android Studio project created (Empty Activity type), if you add the following lines:

    // 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任务时,将看到错误.查看输出:

To the app's build.gradle file you will see errors when you try to run the connectedCheck task for the project. See output:

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

如果我使用相同的lifecycleVersioncoreTestingVersion值(例如2.0.0),则不会发生错误,但是lint抱怨核心测试依赖项具有更新的版本(2.0.1). (尽管它至少运行了,但:P)我认为androidx的优点之一是它可以无问题地更新单个作品?

If I use the same lifecycleVersion and coreTestingVersion value (2.0.0 for example) the errors do not occur, but lint complains that the core testing dependencies have an updated version (2.0.1). (At least it runs, though :P) I thought one of the advantages of androidx was that it would allow for updating individual pieces without issue?

以下是显示问题的示例应用程序: https://github.com/ZOlbrys/CoreTestingVersionExample

Here's a sample app showing the issue: https://github.com/ZOlbrys/CoreTestingVersionExample

仅通过此项目中的终端运行connectedCheck即可查看构建失败.

Simply run connectedCheck via terminal in this project to see the build fail.

关于如何解决此问题的任何想法?

Any ideas on how to fix this?

为此创建了Google问题,请参见 https://issuetracker.google.com/issues/129316035

edit: created google issue for this, see https://issuetracker.google.com/issues/129316035

推荐答案

要解决此问题,您将必须使用依赖项解决策略.这是我遇到类似问题时的解决方法:

To resolve this issue you will have to use a dependency resolution strategy. This is how I resolved it when I faced a similar issue: Cannot find version of 'androidx.arch', 'androidx.room', etc

configurations.all
            {
                resolutionStrategy.eachDependency { details ->
                    if (details.requested.group == 'androidx.arch.core'
                            && !details.requested.name.contains('core-runtime')) {
                        details.useVersion "2.0.1"
                    }

}

每个依赖项的

Fyi表示为实现" group *: name :* version "

Fyi for each dependency is represented as implementation "group*:name:*version"

这篇关于找不到满足版本限制的'androidx.arch.core:core-common'版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆