Why do I get "Configuration 'compile' is obsolete"

Viewed 429

I have read SO threads about this problem and I have added

classpath 'com.google.gms:google-services:3.2.1'

to build.gradle, but it doesnt help. here's the full gradle:

buildscript {
    repositories {
        maven {
            url 'https://maven.fabric.io/public'
        }
        mavenCentral()
        jcenter()
        google()
    }
    dependencies {
        classpath 'io.fabric.tools:gradle:1.26.1'
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:3.2.1'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url "https://jitpack.io" }
    maven { url 'https://maven.fabric.io/public' }
    maven {
        url uri('mint-plugin-repo-5.2.4')
    }
    google()
}
android {

    flavorDimensions "default"

    signingConfigs {
        config {
            keyAlias 'xxx'
            keyPassword 'xxx'
            storeFile file('/Users/claude/Documents/xxx')
            storePassword 'xxx'
        }
    }
    compileSdkVersion 28

    defaultConfig {
        targetSdkVersion 28
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
        minSdkVersion 19
    }

    productFlavors {
        So_TEST {

            applicationId "com.bluelionsolutions.mytaxicontrol"
            versionName "5.0.3.4"

            buildConfigField 'String', 'mtc', '"xxx"'
            resValue "string", "app_name", "xxx"

            resValue "string", "google_maps_api_key", "xxx"
        }
    }
}

dependencies {
    implementation 'com.braintreepayments.api:drop-in:3.7.0'
    implementation 'commons-codec:commons-codec:1.10'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:mediarouter-v7:28.0.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.google.android.gms:play-services:11.8.0'
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
        transitive = true;
    }
}
apply plugin: 'com.google.gms.google-services'
2 Answers

The Google services Gradle plugin is outdated. Use version 4.x instead:

classpath 'com.google.gms:google-services:4.2.0'

But to actually find the culprit, use the dependencies task on your module and find the compile configuration:

gradle :app:dependencies

Additionally you could consider reordering your repositories definitions.

Compile is deprecated as of Android Gradle Plugin 3.0.0.

Use implementation or api according to your use case.

Difference between implementations and api link

Related