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

后端 未结 5 1464
日久生厌
日久生厌 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-01 23:52

    Explaination:

    since the compile is been obsolete in 2018 you must change this configuration as follows: 1. open build.gradle(module:app) app file and make following changes in it. 2. replace compile with api wherever api ref. like: volley, GitHub dependancy.strong text is used and 3. replace compile with implementation incase of using android libraries like play-services-maps,appcompat-v7 etc.

    example: old way

      dependencies {
         testCompile'junit:junit:4.12'
        compile 'com.android.volley:volley:1.1.0' 
    

    Change it to:

     dependencies {
        testImplementation 'junit:junit:4.12'
        implementation 'com.android.volley:volley:1.1.0'
    

    if the issue still persists:

    open build.gradle (Project: yourproject) file and change the google gms services to the latest

    dependencies {
            classpath 'com.android.tools.build:gradle:3.2.1'
    
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    

    Also if the gradle sync is still failing:

    Open gradle-wrapper.properties file and replace it with following:

    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    

提交回复
热议问题