Gradle错误:安装新的Android Studio版本时发生。

huangapple 未分类评论45阅读模式
英文:

Gradle error new install of Android Studio

问题

大家好,我正在尝试安装Android Studio,在完成安装并创建了一个Android项目后,我遇到了以下错误:

org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: 无法为配置“:classpath”解析所有文件。

org.gradle.internal.resolve.ModuleVersionResolveException: 无法解析com.android.tools.build:gradle:3.0.0。

org.gradle.internal.resolve.ModuleVersionResolveException: 无法在离线模式下获取com.android.tools.build:gradle:3.0.0的缓存版本。
点击此处查看图片描述
当我打开*.xml布局文件时,出现“在成功同步项目之后才可使用设计编辑器”的提示。

在Google上搜索了这个问题后,我在build.gradle中添加了google(),但问题仍然存在。

请问有什么帮助或修复问题的想法吗?提前感谢!

  [1]: https://i.stack.imgur.com/dF7Dl.png
英文:

Hi guys I am trying to install Andorid Studio after finishing the installation and creating an android project I am receiving the following errors:

org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':classpath'.

org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.0.0.

org.gradle.internal.resolve.ModuleVersionResolveException: No cached version of com.android.tools.build:gradle:3.0.0 available for offline mode.
[enter image description here][1]
and when I go to *.xml layout file I receive "Design editor is unavailable until after a successful project sync"

Searching on google for this issue, I added google() at build.gradle but the issue remains.

Please any kind of help or ideas to fix the problem ? Thnx in advance

答案1

得分: 0

禁用Gradle的离线模式,方法是打开 文件 - 项目设置 - 构建、执行、部署 - Gradle,然后在命令行选项中移除--offline选项。(或者,在Gradle窗口中直接点击-//-图标。)

然后,连接到互联网并运行Gradle构建。

构建运行一次后,可以再次启用离线模式。

英文:

Disable the offline mode of Gradle by going to File - Project Settings - Build, Execution, Deployment - Gradle - Remove --offline in Command Line options.(Or, simply click the -//- icon in the Gradle window.)

Then, connect to the internet and run Gradle build.

After the build has run once, you can enable the offline mode again.

huangapple
  • 本文由 发表于 2020年4月10日 06:02:43
  • 转载请务必保留本文链接:https://java.coder-hub.com/61130943.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定