Johann
Johann

Reputation: 29885

Gradle warns about a configuration that doesn't exist in my build.gradle file

Gradle gives the warning:

Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.

There is no "compile" configuration in my build.gradle file, so why is it giving me this warning?

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'realm-android'

android {
    compileSdkVersion 25
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "com.ktoi.toi"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
}
kapt {
    generateStubs = true
}
buildscript {
    ext.supportVersion = '25.0.0'
    ext.daggerVersion = '2.7'
    ext.retrofitVersion = '2.1.0'
    ext.rxVersion = '1.2.1'
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath "io.realm:realm-gradle-plugin:2.1.1"
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:25.0.0'
    testImplementation 'junit:junit:4.12'
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation "com.android.support:cardview-v7:${supportVersion}"
    implementation "com.android.support:design:${supportVersion}"

    // Dagger 2
    implementation "com.google.dagger:dagger:${daggerVersion}"
    kapt "com.google.dagger:dagger-compiler:${daggerVersion}"
    compileOnly "org.glassfish:javax.annotation:3.1.1"

    //Retrofit 2
    implementation "com.squareup.retrofit2:retrofit:${retrofitVersion}"
    implementation "com.squareup.retrofit2:adapter-rxjava:${retrofitVersion}"
    implementation "com.squareup.retrofit2:converter-gson:${retrofitVersion}"

    implementation 'com.google.code.gson:gson:2.8.0'

    implementation "io.reactivex:rxjava:${rxVersion}"
    implementation "io.reactivex:rxandroid:${rxVersion}"

    implementation 'com.github.bumptech.glide:glide:3.7.0'

  }
repositories {
    mavenCentral()
}

Upvotes: 1

Views: 928

Answers (4)

karan
karan

Reputation: 8853

Similar issue has been reported. Check this https://issuetracker.google.com/issues/74048134

There also is problem with older google services version. make sure you are using classpath 'com.google.gms:google-services:3.2.0' or higher in your app level gradle.

Upvotes: 0

Lakhwinder Singh
Lakhwinder Singh

Reputation: 7219

Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.

This is due to, one of your dependencies uses compile instead of Implementation

Upvotes: 0

laalto
laalto

Reputation: 152927

realm-gradle-plugin:2.1.1 is old and old versions of the plugin add compile dependencies. Newer versions of the plugin correctly add api dependencies in place of compile if your project has those.

As of now, 5.8.0 is the newest version on bintray.

Upvotes: 3

mgouravsharma21
mgouravsharma21

Reputation: 12

Use

implementation "org.glassfish:javax.annotation:3.1.1"

instead of

compileOnly "org.glassfish:javax.annotation:3.1.1"

Upvotes: -2

Related Questions