Sharecodepoint popular queries

Friday, 17 January 2020

Error Configuration : Android Studio 3.1.0 - Configuration 'compile' is obsolete and has been replaced with 'implementation'


WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html Affected Modules: app

The Error in Android Studio.

Configuration 'androidTestCompile' is obsolete and has been replaced with 'androidTestImplementation' and 'androidTestApi'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configuration 'androidTestApi' is obsolete and has been replaced with 'androidTestImplementation'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

Solution:

Goto Gradle Scripts.

Then Goto build.gradle(Module: app)

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

Example :

If you using compile then show the configuration error just replace compile to implementation.

This is the old way of writing the dependency libraries (for Gradle version 2 and below):

dependencies with Warning in android studio 3.1

dependencies {

    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'com.android.support:appcompat-v7:25.3.1'

    compile 'com.android.support:support-v4:25.3.1'

    compile 'com.android.support:design:25.3.1'

    compile 'com.google.code.gson:gson:2.6.2'

    compile 'com.squareup.retrofit2:converter-gson:2.1.0'

    compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'

    compile 'com.github.channguyen:rsv:1.0.1'

    compile 'com.valdesekamdem.library:md-toast:0.9.0'

    compile 'com.google.android.gms:play-services-ads:11.0.4'

    testCompile 'junit:junit:4.12'

}

You have to Just Change the following words: 

1) compile to implementation where word compile is returned.

2) testCompile to testImplementation where testCompile is returned.

3) androidTestCompile to androidTestImplementation where androidTestCompile is return.

Check the solution for this Example

dependencies OK in android studio 3.1 | In Android Studio version 3.1 dependencies compile word is replaced to implementation. This is the new (right) way of importing the dependencies for Gradle version 3:

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.android.support:appcompat-v7:25.3.1'

    implementation 'com.android.support:support-v4:25.3.1'

    implementation 'com.android.support:design:25.3.1'

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

    implementation 'com.squareup.retrofit2:converter-gson:2.1.0'

    implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'

    implementation 'com.github.channguyen:rsv:1.0.1'

    implementation 'com.valdesekamdem.library:md-toast:0.9.0'

    implementation 'com.google.android.gms:play-services-ads:11.0.4'

    testImplementation 'junit:junit:4.12'

}

 

If you Want to add a third-party library like retrofit and another library. Then you have to use the implementation Keyword not compile Keyword.

For Example:

This is wrong.
compile 'com.squareup.retrofit2:retrofit:2.4.0'

This is Right.
implementation 'com.squareup.retrofit2:retrofit:2.4.0'

0 comments:

Post a comment

 

Version 23.2.3.4 - 2016 - 2020 - © Sharecodepoint | Made in India. | Copyright Content | Facebook | Twitter | Instagram | Youtube