I am getting error: Configuration 'compile' is obsolete and has been replaced with 'implementation'. It will be removed at the end of 2018

后端 未结 5 1424
日久生厌
日久生厌 2021-02-01 23:21

I got this error after an update of Android Gradle plugin and Android Studio.

I have checked this question (Android Studio build.gradle warning message), but I am not ab

5条回答
  •  轮回少年
    2021-02-02 00:07

    Here is the complete solution:

    steps

    1) Use the new dependency configurations in gradle file Replace compile with an implementation For ex:

    dependencies {
        compile 'com.android.support:support-v4:27.0.3'
    }
    

    Should be:

    dependencies {
        implementation 'com.android.support:support-v4:27.0.3'
    }
    

    b) Replace testCompile with testImplementation

    For ex:

    testCompile 'junit:junit:4.12'
    

    should be

    testImplementation 'junit:junit:4.12'
    

    c) For library replace compile with api

    2) Upgrade classpath com.google.gms:google-services to classpath 'com.google.gms:google-services:3.2.0' in file in build.gradle (Use latest one)

    3) File -> Invalidate Cache

    Still Not Working: Then try below steps

    1) Close the project.

    2) Delete .gradle folder.

    3) Open again the project

    Now it will works

提交回复
热议问题