无法解析androidx.drawerlayout:drawerlayout:1.0.0

时间:2019-04-23 09:07:02

标签: android android-gradle android-jetpack

将我的android studio从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无法解决它们。我该如何解决,任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

我通过还原 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'

这似乎是临时解决方案。