在Android Studio中执行 gradle clean或者编译项目的时候,会报如下的错误:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.android.support:appcompat-v7:22.2.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/appcompat-v7/22.2.1/appcompat-v7-22.2.1.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/22.2.1/appcompat-v7-22.2.1.jar
file:/D:/android-sdk/extras/android/m2repository/com/android/support/appcompat-v7/22.2.1/appcompat-v7-22.2.1.pom
file:/D:/android-sdk/extras/android/m2repository/com/android/support/appcompat-v7/22.2.1/appcompat-v7-22.2.1.jar
file:/D:/android-sdk/extras/google/m2repository/com/android/support/appcompat-v7/22.2.1/appcompat-v7-22.2.1.pom
file:/D:/android-sdk/extras/google/m2repository/com/android/support/appcompat-v7/22.2.1/appcompat-v7-22.2.1.jar
Required by:
voicedemo:app:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.android.support:appcompat-v7:22.2.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/appcompat-v7/22.2.1/appcompat-v7-22.2.1.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/22.2.1/appcompat-v7-22.2.1.jar
file:/D:/android-sdk/extras/android/m2repository/com/android/support/appcompat-v7/22.2.1/appcompat-v7-22.2.1.pom
file:/D:/android-sdk/extras/android/m2repository/com/android/support/appcompat-v7/22.2.1/appcompat-v7-22.2.1.jar
file:/D:/android-sdk/extras/google/m2repository/com/android/support/appcompat-v7/22.2.1/appcompat-v7-22.2.1.pom
file:/D:/android-sdk/extras/google/m2repository/com/android/support/appcompat-v7/22.2.1/appcompat-v7-22.2.1.jar
Required by:
voicedemo:app:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
解决方法:是在Android Studio中依次点击Tools -> Android -> Android SDK Manager,在"Extras"选项下更新如下两个文件即可。
Android Support Repository , Android Support Library