1

My project suddenly couldn't build gradle. The following Error happens:

Error:Failed to resolve: play-services-basement

Here is my build.grdle:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:4.0.1'
    }
}

allprojects {
    repositories {
        google()
        maven { url 'https://maven.google.com' }
        jcenter()
        mavenCentral()
    }
}

As I searched, there were two solutions:

  1. add ‍‍jcenter{url "http://jcenter.bintray.com/"} instead of jcenter()

  2. move google() before jcenter()

but none worked. What Should I do?

tnx

P.S I know my question is similar to this and this but the solutions doesn't work for me.


update 1: app gradle

apply plugin: 'com.android.application'
android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.my.app"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "0.7"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    applicationVariants.all { variant ->
        variant.resValue "string", "versionName", variant.versionName
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    google()
    jcenter()
}
dependencies {
    implementation 'com.android.support:recyclerview-v7:26.1.0'
//    implementation 'com.google.firebase:firebase-core:16.0.1'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
//    compile 'im.crisp:crisp-sdk:0.1.10'

    implementation 'com.getkeepsafe.taptargetview:taptargetview:1.11.0'
    compile 'com.stephentuso:welcome:1.4.1'

    compile 'co.ronash.android:pushe-base:1.4.0'
    compile 'com.google.android.gms:play-services-gcm:15.0.1'
    compile 'com.google.android.gms:play-services-location:15.0.1'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:multidex:1.0.2'
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support:cardview-v7:26.0.2'
    compile 'com.android.support:design:26.0.2'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.android.support:customtabs:26.1.0'
//    compile 'com.google.firebase:firebase-auth:16.0.2'
    compile 'com.google.android.gms:play-services-auth:15.0.1'
    compile 'com.google.code.gson:gson:2.7'
    compile('io.socket:socket.io-client:1.0.0') {
        // excluding org.json which is provided by Android
        exclude group: 'org.json', module: 'json'
    }
    compile 'com.android.volley:volley:1.0.0'
    testCompile 'junit:junit:4.12'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}


configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.0'
            }
        }
    }
}

apply plugin: 'com.google.gms.google-services'

udpate2: project gradle:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.1.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        maven { url 'https://maven.google.com' }
        jcenter()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
hsbr13
  • 431
  • 1
  • 8
  • 21
  • classpath 'com.google.gms:google-services:4.0.1' should be classpath 'com.google.gms:google-services:4.1.0' Can you share you app level gradle file, the one in app/build.gradle – Reda Dec 03 '18 at 12:45
  • @Reda that did not work. I added what you said. – hsbr13 Dec 03 '18 at 12:58
  • try updating your `classpath 'com.android.tools.build:gradle:3.0.1'` to `3.2.1` – karan Dec 03 '18 at 12:59
  • https://stackoverflow.com/questions/52948514/android-gradle-failed-to-resolve-play-services-basement – Hichem Romdhane Dec 03 '18 at 13:02
  • Upload your Project gradle too, not only the App gradle, and check that google() is before jcenter() in that gradle file. – dglozano Dec 03 '18 at 13:07
  • Possible duplicate of [Android gradle Failed to resolve: play-services-basement](https://stackoverflow.com/questions/52948514/android-gradle-failed-to-resolve-play-services-basement) – dglozano Dec 03 '18 at 13:08
  • @KaranMer did not work – hsbr13 Dec 03 '18 at 13:25
  • @dglozano I did. I had done that, but did not work – hsbr13 Dec 03 '18 at 13:26
  • @dglozano the question is the same but the solutions does not work at all so I had to ask it again – hsbr13 Dec 03 '18 at 13:28

0 Answers0