问题
After updating my android studio from 3.3 to 3.4 I am now getting this error.
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
Notice that My project was fine before upgrading Android Studio.
To fix this I tried the following: 1. Adding the two dependencies
implementation 'androidx.drawerlayout:drawerlayout:1.0.0'
implementation 'androidx.cursoradapter:cursoradapter:1.0.0'
But the problem is still there.
- Invalidate cache and restart.
- Clean and rebuild
All of them didn't work.
The dependencies which are seemed not to be resolved are listed here in Google's Maven Repository but android studio could not resolve them. How can I fix this, Any help will be appreciated.
回答1:
I solved my problem by reverting distributionUrl in gradle-wrapper.properties
from
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
back to
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
And also reverting gradle dependency in build.gradle from
classpath 'com.android.tools.build:gradle:3.4.0'
back to
classpath 'com.android.tools.build:gradle:3.3.2'
This seems like temporary solution though.
来源:https://stackoverflow.com/questions/55807789/could-not-resolve-androidx-drawerlayoutdrawerlayout1-0-0