问题
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'.
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.6.1.
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: No cached version of com.android.tools.build:gradle:3.6.1 available for offline mode.
回答1:
It is a problem found in the new Android Studio 3.6 update. But it is basically not a problem.
All you have to do is the following:
To enable or disable Gradle's offline mode, first select View > Tool Windows > Gradle from the menu bar. Then, near the top of the Gradle window, click Toggle Offline Mode
Here are some screenshots:
- First go here
- Toggle this option
回答2:
I opened an old project with Eclipse. For me, it helped to add the following in build.gradle:
apply plugin: 'com.android.application'
repositories {
// order may be important!
google()
jcenter()
}
Source: https://stackoverflow.com/a/50285646/1097104
In addition, a few times I had to use File > Invalidate Caches / Restart.
回答3:
The project that you are trying to build probably doesn't have the required SDK version. You can download it from the Android Studio within the "Preferences" dialog, under Appearance & Behavior → System Settings → Android SDK. Preferences Screenshot.
来源:https://stackoverflow.com/questions/60463052/andriod-gradle-sync-failed