在创建第一个Android Studio项目时,我遇到了一下三个错误。
-
Could not install Gradle distribution
-
Error:Failed to open zip file. Gradle’s dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
-
Could not GET ‘https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.1.0/gradle-4.1.0.pom’. Received
解决方案:
首先解决第一个和第二个问题,如果你可以手动下载该文件。
在出现这个问题时,会弹出设置代理的窗口,点击No,并删除gradle.properties的文件夹,即刚刚设置的内容。然后在设置中取消代理。
我最初虽然下载了gradle的文件,但仍然有第二个错误,就是没有设置specific location。
在如下图中的设置中,设置Specific Location然后选择你下载的gradle。
第三个问题只需要设置一下repository即可。
打开文件目录中的build.gradle文件将下面的内容复制