3

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

jean d'arme
  • 4,033
  • 6
  • 35
  • 70

2 Answers2

7

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.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
2

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

Jemshit
  • 9,501
  • 5
  • 69
  • 106