问题
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.1.0.
Could not resolve com.android.support:appcompat-v7:26.1.0. Required by: project :app
No cached version of com.android.support:appcompat-v7:26.1.0 available for offline mode.
Error:Could not resolve all files for configuration ':app:debugCompileClasspath'.
Could not resolve com.android.support:appcompat-v7:26.1.0. Required by: project :app No cached version of com.android.support:appcompat-v7:26.1.0 available for offline mode. No cached version of com.android.support:appcompat-v7:26.1.0 available for offline mode. Could not resolve com.android.support.constraint:constraint-layout:1.1.0-beta3. Required by: project :app No cached version of com.android.support.constraint:constraint-layout:1.1.0-beta3 available for offline mode. No cached version of com.android.support.constraint:constraint-layout:1.1.0-beta3 available for offline mode. Could not resolve com.android.support:design:26.1.0. Required by: project :app No cached version of com.android.support:design:26.1.0 available for offline mode. No cached version of com.android.support:design:26.1.0 available for offline mode. Could not resolve com.android.support:cardview-v7:26.1.0. Required by: project :app No cached version of com.android.support:cardview-v7:26.1.0 available for offline mode. No cached version of com.android.support:cardview-v7:26.1.0 available for offline mode. Could not resolve com.google.android.gms:play-services-ads:11.4.2. Required by: project :app No cached version of com.google.android.gms:play-services-ads:11.4.2 available for offline mode. No cached version of com.google.android.gms:play-services-ads:11.4.2 available for offline mode. Could not resolve com.android.support:support-v4:26.1.0. Required by: project :app No cached version of com.android.support:support-v4:26.1.0 available for offline mode. No cached version of com.android.support:support-v4:26.1.0 available for offline mode.
I want to make project offline.. if I dont have internet connection.. (For new project not connect to internet)
回答1:
I have same issue after updating AS to 3.1.3 Issues with me:
I am getting these errors while syncing gradle:-
Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve xxx.
Error:Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve xxx.
Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve xxx.
Error:Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve xxx.
Error:Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve xxx.
Solution for fix this issue:
1. Check proxy in SDK Manager > Appearance & Behavior > System Settings>HTTP Proxy. Auto-detect proxy settings should be checked.
2. Default settings Build, Execution, Deployment > Build Tools > Gradle Uncheck Offline work.
3. In left side panel select Project explorer > Android Check Gradel Scripts dir. look for cradle.properties (Global Properties) It contains proxy added properties please do commented all of them.
Try to clean and build.
Now check all dependencies resolve.
来源:https://stackoverflow.com/questions/48171692/unable-to-resolve-all-dependencies-in-android-studio-3-0-1