mobdevkun
mobdevkun

Reputation: 463

How to solve this "Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'."

When I try use issue from GitHub. I give in out

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

I try use Material Calendar View

My gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.mederov.timelord"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}



dependencies {
    compile 'com.applandeo:material-calendar-view:1.5.1'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:support-v4:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.github.bumptech.glide:glide:4.4.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
    implementation 'de.hdodenhof:circleimageview:3.0.0'

}

Upvotes: 0

Views: 108

Answers (2)

Fred
Fred

Reputation: 17095

In the later gradle versions compile was replaced with both api and implementation.

api exposes the dependencies to external modules, just like compile does. So if you have module A depends on module B which depends on C, if C changes, then A needs to be recompiled. The Gradle team recognized this was unnecessary in a lot of cases, so it introduced implementation so if C changes only modules that depend on it will have to recompile, which means only module B. This shortens build times and makes the project much more tidy.

In short, if you replace all compile with api the result will be the same and that's what the warning is hitting at.

However, as a rule of thumb you'd want to use implementation whenever possible to avoid polluting the project with dependencies.

I'd try to first replace compile with implementation and build the project.

This link has a much better explanation and visualization of the differences.

Upvotes: 1

Vadim Eksler
Vadim Eksler

Reputation: 887

You can change this line compile 'com.applandeo:material-calendar-view:1.5.1'

to this implementation 'com.applandeo:material-calendar-view:1.5.1'

Upvotes: 1

Related Questions