Gradle 无法添加编译 'com.google.android.gms:play-services:7.0.0'

Gradle can't manage to add compile 'com.google.android.gms:play-services:7.0.0'

我不敢相信没有人找到解决这个问题的方法。我想在我的应用程序中添加横幅,但 Android Studio 的 Gradle 系统试图让我知道这不是一个好主意。它看起来像这样:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.(package).(name)"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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

日志:

Error:A problem occurred configuring project ':app'.

Could not resolve all dependencies for configuration ':app:_debugCompile'. Could not find com.android.support:support-v4:22.0.0. Searched in the following locations: https://jcenter.bintray.com/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom https://jcenter.bintray.com/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar file:/C:/Program Files (x86)/Android/sdk/extras/android/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom file:/C:/Program Files (x86)/Android/sdk/extras/android/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar file:/C:/Program Files (x86)/Android/sdk/extras/google/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom file:/C:/Program Files (x86)/Android/sdk/extras/google/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar Required by: FakeCall:app:unspecified > com.android.support:appcompat-v7:21.0.3 Could not find com.android.support:support-v4:22.0.0. Searched in the following locations: https://jcenter.bintray.com/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom https://jcenter.bintray.com/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar file:/C:/Program Files (x86)/Android/sdk/extras/android/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom file:/C:/Program Files (x86)/Android/sdk/extras/android/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar file:/C:/Program Files (x86)/Android/sdk/extras/google/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.pom file:/C:/Program Files (x86)/Android/sdk/extras/google/m2repository/com/android/support/support-v4/22.0.0/support-v4-22.0.0.aar Required by: FakeCall:app:unspecified > com.google.android.gms:play-services:7.0.0 > com.google.android.gms:play-services-base:7.0.0

添加 compile 'com.android.support:support-v4:22.0.0'

通过 SDK 管理器,您需要确保 Android Support Repository 是最新的 - 这是 Android 支持库依赖关系得到解决的地方。