无法解析 androidx.drawerlayout:drawerlayout:1.0.0

Could not resolve androidx.drawerlayout:drawerlayout:1.0.0

将我的 android 工作室从 3.3 更新到 3.4 后,我现在收到此错误。

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve androidx.drawerlayout:drawerlayout:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve androidx.cursoradapter:cursoradapter:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.drawerlayout:drawerlayout:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.cursoradapter:cursoradapter:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve androidx.drawerlayout:drawerlayout:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve androidx.cursoradapter:cursoradapter:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve androidx.drawerlayout:drawerlayout:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve androidx.cursoradapter:cursoradapter:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve androidx.drawerlayout:drawerlayout:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve androidx.cursoradapter:cursoradapter:1.0.0.
Show Details
Affected Modules: app

请注意,在升级 Android Studio 之前,我的项目没有问题。

为了解决这个问题,我尝试了以下方法: 1.添加两个依赖

    implementation 'androidx.drawerlayout:drawerlayout:1.0.0'
    implementation 'androidx.cursoradapter:cursoradapter:1.0.0'

但问题依旧

  1. 使缓存无效并重新启动。
  2. 清理并重建

全部无效。

Google's Maven Repository 中列出了似乎无法解决的依赖项,但 android studio 无法解决它们。我该如何解决这个问题,我们将不胜感激。

我通过恢复 gradle-wrapper.properties

中的 distributionUrl 解决了我的问题

来自

distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

回到

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

并且还恢复 build.gradle 中的 gradle 依赖 来自

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

回到

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

虽然这似乎是临时解决方案。