英文:
How to fix Gradle in android studio build issue showing exceptions of classpath
问题
我下载了Android Studio并尝试导入一个项目,但是出现了有关classpath的异常。异常信息如下:
>org.gradle.internal.resolve.ModuleVersionResolveException: 离线模式下没有可用的 com.android.tools.build:gradle:3.6.1 版本。
>org.gradle.internal.resolve.ModuleVersionResolveException: 无法解析 com.android.tools.build:gradle:3.6.1。
>org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: 无法为配置 ':classpath' 解析所有文件。
我已经尝试过但未成功的解决方案如下:
- 已尝试将classPath修复为我的Gradle版本并进行了(无效并重新启动)操作。
- 尝试删除Gradle文件,然后通过重新生成来重新启动Gradle文件的构建。
- 还尝试将最低SDK设置为新项目生成的值。
但是我仍然无法解决这个问题,问题仍然存在。
英文:
I downloaded Android Studio and tried to import a project but the Exception of classpath showed up. The Exceptions are:
>org.gradle.internal.resolve.ModuleVersionResolveException: No cached version of com.android.tools.build:gradle:3.6.1 available for offline mode.
>org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.6.1.
>org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':classpath'.
Now the solutions I have already tried but failed are.
- Already tried to fix the classPath to my Gradle version and (Invalidate and restart)
- Tried to Delete the Gradle files and restart the building of Gradle files by regenerating it.
- And tried to also set the min SDK to what my new Project generates.
But I am still now able to clear that issue and it still exists.
答案1
得分: 0
只需禁用gradle的离线模式并尝试,就可以正常运行。
在Android Studio 3.6.1中禁用离线模式的方法:
专注分享java语言的经验与见解,让所有开发者获益!
评论