Search code examples
androidgradleandroid-gradle-pluginbuild.gradlegradlew

Problems using Gradle console command (gradlew)


I'm compiling a project with gradlew command in console and i'm getting this error:

BUILD FAILED

Total time: 16.775 secs
Err:
Err:FAILURE: Build failed with an exception.
Err:
Err:* What went wrong:
Err:A problem occurred configuring project ':capLibrary'.
Err:> Could not resolve all dependencies for configuration ':capLibrary:_debugCompile'.
Err:   > Could not find com.android.support:support-v4:22.2.1.
Err:     Searched in the following locations:
Err:         https://jcenter.bintray.com/com/android/support/support-v4/22.2.1/support-v4-22.2.1.pom
Err:         https://jcenter.bintray.com/com/android/support/support-v4/22.2.1/support-v4-22.2.1.jar
Err:     Required by:
Err:         CapAndroid:capLibrary:unspecified
Err:   > Could not find com.google.android.gms:play-services:7.5.0.
Err:     Searched in the following locations:
Err:         https://jcenter.bintray.com/com/google/android/gms/play-services/7.5.0/play-services-7.5.0.pom
Err:         https://jcenter.bintray.com/com/google/android/gms/play-services/7.5.0/play-services-7.5.0.jar
Err:     Required by:
Err:         CapAndroid:capLibrary:unspecified

I don't know what is going wrong, these are my gradle dependencies:

For the application module:

dependencies {
    compile project(':capLibrary')
    compile 'com.google.android.gms:play-services:7.5.0'
}

For the library module ( capLibrary ):

dependencies {
    compile 'com.android.support:support-v4:22.2.1'
    compile 'com.google.android.gms:play-services:7.5.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

This is the full gradle.build file for the library ( capLibrary ):

apply plugin: 'com.android.library'

android {
    compileSdkVersion 'Google Inc.:Google APIs:22'
    buildToolsVersion "22.0.1"

    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 10
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        }
        debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:22.2.1'
    compile 'com.google.android.gms:play-services:7.5.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

This is the full gradle.build for the application module:

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 'Google Inc.:Google APIs:22'
        buildToolsVersion "22.0.1"

        defaultConfig {
            applicationId "com.example.launcher"
            minSdkVersion 10
            targetSdkVersion 10
        }

        signingConfigs {
            release {
                storeFile file("dummy")
                storePassword "dummy"
                keyAlias "dummy"
                keyPassword "dummy"
            }
        }

        buildTypes {
            release {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
            }
            debug {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
            }
        }
    }

    dependencies {
        compile project(':capLibrary')
        compile 'com.google.android.gms:play-services:7.5.0'
    }

Solution

  • Run Android SDK Manager.

    tip: in console write >> android [enter]

    and install from Android SDK Manager / Extras:

    • Android support repository
    • Google repository