今天更新Android Studio后打开Project,报如下错误:
Error:Could not find com.android.tools.build:gradle:2.2.1.
Searched in the following locations:
file:/D:/Program Files/Android/android-studio/gradle/m2repository/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.pom
file:/D:/Program Files/Android/android-studio/gradle/m2repository/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.jar
后来尝试后找到的解决方法为:
1、进入file:/D:/Program Files/Android/android-studio/gradle/m2repository/com/android/tools/build/gradle/,查看当前已有内容如下
2、于是在build.gradle中做如下修改
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
3、sync后解决。