Andriod Gradle Sync failed

心已入冬 提交于 2020-03-17 11:40:10

问题


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:

  1. First go here
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!