这个是一个老掉牙的问题,并且解决途径各异。更诡异的是本来好好的,过了个周末发现就不行了。我严重怀疑这个gradle文件的编译可能会依赖服务器,并且有一些强制的要求。
贴出来一个答案,大家从这个答案去寻找思路吧。
The latest stable version referenced in the release channel as of 6th June, 2016 is
classpath 'com.android.tools.build:gradle:2.1.2'
Or the latest beta version via dev channel / beta channel as of 8th June, 2016 is
classpath 'com.android.tools.build:gradle:2.2.0-alpha3'
And the latest alpha version from the canary channel as of 8th July, 2016 gives you the option to use
classpath 'com.android.tools.build:gradle:2.2.0-alpha5'
Updating requires you to use the gradle wrapper for 2.10 if you were still on 2.8
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
On android studio you can find your wrapper by changing to the project view and looking in gradle
/wrapper
/gradle-wrapper.properties