2017-03-03 遇到的一点小问题
今天打开Android Studio 右上角出现提示升级对话框,建议我将版本从2.2.3升级到2.3,关掉没有理会。过一会同事Q上问我升级Studio版本没?以为有新功能,不更新就会Out,赶紧找到菜单升级。速度还很快,一会就升级成功。没想到三分钟之后,同事又发来一条消息“先别升,我被坑了,被挡在墙外了”。晕。。。说句话隔三分钟。
然后我的项目也悲剧了,提示:
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)```

想起之前看到的工具[XX-net](https://github.com/XX-net),配置了一下,重新打开却一直显示**Gradle Download**

好吧,还是手动配置一下省事。

项目用的build.gradle还是**classpath 'com.android.tools.build:gradle:2.2.3'**,但之前的gradle-wrapper.properties文件里的**distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip**已经提示过期,最低版本需要**distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip**。

把[gradle-3.3下载地址](https://services.gradle.org/distributions/gradle-3.3-all.zip)复制到迅雷,下载,解压,再设置关联Gradle,刷新就可以了。

不过,这时候又会提示你升级Gradle。

升级后会变成**classpath 'com.android.tools.build:gradle:2.3.0'**和**distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip**
因为我的项目的**buildToolsVersion**是**24.0.3**,所以升级后会提示你最低必须25.0.0,改完之后,引用的包也必须从**compile 'com.android.support:support-v4:24.2.1'**升级为**compile 'com.android.support:support-v4:25.2.0'**,因为怕麻烦,懒得改,所以又改回之前的Gradle版本了,其他项目看到这个提示也直接拒绝升级。


(⊙﹏⊙)b,之前下载的gradleZip文件一直不会用,都不知道要解压后才能管理,下了一堆都没用到,还是这次出了问题,问了四木才知道,果断把之前的都删了。

2017-03-08更新,今天才知道[原来Android Studio关联的Gradle在这里](http://www.jianshu.com/p/4cd57faee434),汗!所以其实不用那么麻烦去配置的,下载好覆盖一下就行。