当我打开其他人的android工作室项目时,如何防止错误消息?

时间:2015-02-15 06:41:18

标签: android android-studio

我正在评估我的同伴Android Studio项目。

当我试图跑步时,我得到以下内容。

错误讯息:

Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find com.android.support:appcompat-v7:21.0.3.
     Searched in the following locations:
         https://jcenter.bintray.com/com/android/support/appcompat-v7/21.0.3/appcompat-v7-21.0.3.pom
         https://jcenter.bintray.com/com/android/support/appcompat-v7/21.0.3/appcompat-v7-21.0.3.jar
         file:/Users/kim/Documents/android-sdk-macosx/extras/android/m2repository/com/android/support/appcompat-v7/21.0.3/appcompat-v7-21.0.3.pom
         file:/Users/kim/Documents/android-sdk-macosx/extras/android/m2repository/com/android/support/appcompat-v7/21.0.3/appcompat-v7-21.0.3.jar
     Required by:
         ModernArtUI:app:unspecified

我解决问题的唯一方法是:

进入他们的build.gradle(模块:app)

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

并改为

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

得到这个:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
}

更改为

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.2'
}

如何避免重复更改build.gradle?

1 个答案:

答案 0 :(得分:1)

您必须使用SDK Manager更新存储库。

错误显示gradle未在您的extras / android / m2repository(Android Repository)中找到app compat库21.0.3。

启动sdk管理器并更新它和构建工具