Error:Failed to open zip file. Gradle's dependency cache may be corrupt (this sometimes occurs after

有时候在导入项目的时候,或者在创建项目的时候会出现这样的错误:

Error:Failed to open zip file. 
Gradle’s dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) 
Re-download dependencies and sync project (requires network) 
Re-download dependencies and sync project (requiresnetwork)


出现这样的错误一般是gradle的版本出现了问题,我有两种解决方法:

第一种是:

    看看没有报错的项目中gradle>>wrapper>>gradle-wrapper.properties中gradle的版本,修改一下就行了,但是有的时候改了还是报错。

第二种:(推荐

   1、打开File>>Settings>>Build,Execution,Deployment>>Gradle


   2、选择本地的gradle保存即可;下边是我的gradle所在的位置,请根据自己的gradle位置进行选择;



   3、应用保存;