今天更新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.jarandroid
後來嘗試後找到的解決方法爲:
一、進入file:/D:/Program Files/Android/android-studio/gradle/m2repository/com/android/tools/build/gradle/,查看當前已有內容以下android-studio
二、因而在build.gradle中作以下修改app
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'gradle
// NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }
三、sync後解決。ui