3
votes

I can't belive that no one found out how to solve this problem. I wanted to add a banner to my app, but Android Studio's Gradle system tries to convience my that this is not so good idea. It looks like this:

    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'
}

Log:

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

2
It looks like your Android Repository (from your SDK Manager) has not been updated.CommonsWare
@CommonsWare You mean Google Repository from SDK Manager -> Extras? Got it - rev. 16.jean d'arme
No, I mean the Android Repository. Your problem is that something is seeking support-v4:22.0.0, which exists, but only if your Android Repository is up to date.CommonsWare
@CommonsWare You. Are. Genius. I known that earlier, but You are always on point! Now it works! Thank You. Please, add it as a answer so I can upvote it :)jean d'arme
Just accept ianhanniballake's answer, as his is the same thing.CommonsWare

2 Answers

7
votes

Via the SDK Manager, you need to make sure you have Android Support Repository up to date - that is where Android Support Library dependencies are resolved.

2
votes

add compile 'com.android.support:support-v4:22.0.0'