Another warning: The "compilation" configuration is deprecated and replaced by the "implementation",

I replaced all compile implementation cases in my build.gradle project, but I still get this warning:

enter image description here

I tried to find a “compilation” in the whole project, but no match was found. So what could be the reason?

+321
source share
24 answers

I updated com.google.gms:google-services from 3.1.1 to 3.2.0 and the warning stopped appearing.

 buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files classpath 'com.google.gms:google-services:3.2.0' } } 
+488
source

I have the same warning for com.google.gms: google-services.

The solution is to update classpath com.google.gms: google-services to classpath 'com.google.gms: google-services: 3.2.0' in the file in build.gradle Project:

enter image description here

 buildscript { repositories { jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:3.1.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files classpath 'com.google.gms:google-services:3.2.0' } } allprojects { repositories { jcenter() google() } } task clean(type: Delete) { delete rootProject.buildDir } 

Android Studio verion 3.1 complie word dependencies replaced by implementation

dependencies with warning in android studio 3.1

 dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:27.1.0' compile 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' } 

Dependencies are normal in android studio 3.1

  dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:27.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' } 

Gradel is generating Android Studio 3.1 for a new project.

Gradel generate by Android Studio 3.1 for new project.

Visit https://docs.gradle.org/current/userguide/dependency_management_for_java_projects.html

For more information https://docs.gradle.org/current/userguide/declaring_dependencies.html

+121
source

I updated com.google.gms: google-services from 3.2.0 to 3.2.1 and the warning stopped appearing.

  buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.1' classpath 'com.google.gms:google-services:3.2.1' } } 
+31
source

Using the latest google gms service has resolved this for me.

At the project level build.gradle:

 buildscript { ... dependencies { classpath 'com.google.gms:google-services:3.2.1' ... } } 
+22
source

Open the build.gradle file located here:

enter image description here

This is the old way to write dependency libraries (for version with gradient 2 and below):

 dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile files('libs/volley.jar') compile 'com.android.support:support-v4:21.+' } 

This is the new (right) way to import dependencies for gradient version 3:

 dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) testImplementation 'junit:junit:4.12' implementation files('libs/volley.jar') implementation 'com.android.support:support-v4:21.+' } 
+17
source

Reply google: https://issuetracker.google.com/issues/74048134

There will be some kind of dependency using compilation, carefully check application dependencies and transitive dependencies.

+13
source

https://issuetracker.google.com/issues/72479188 indicates that plugins can sometimes introduce "compiled" dependencies and that triggers a warning. It is probably just the easiest way to run this problem and wait until they fix it to indicate which plugins are causing the problem.

+7
source

No need to delete a row. As Jkrevis wrote, upgrade com.google.gms: google-services to 3.2.0 and stop the warnings.

+6
source

In my case, this is due to the Realm library, after I updated it to the latest version (5.1.0) of Realm, the problem is solved!

Here is a working gradient scenario:

 buildscript { repositories { jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:3.1.2' classpath "io.realm:realm-gradle-plugin:5.1.0" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files classpath 'com.google.gms:google-services:3.2.1' } } 
+5
source

I ran into this problem without using com.google.gms:google-services . Solution by solving this problem as follows:

  1. check build.gradle files of all projects and modules. Or simply the global search keyword "compile" to find where the reason for this warning is.
  2. if the above method cannot solve this warning, use the CLI command ./gradlew assembleDebug -d > gradle.log
    print detailed debugging information to a file named gradle.log or whatever, because the information is too large. Then search for the word “WARNING” to find the position in gradle.log , typically you can find which dependency or plugin is causing the warning.
+4
source

I have the same problem. I think it's best for now to wait for Google to release the new Gradle patch.

+3
source

Just updating the google-service version did not work for me.

  • First make sure all your compile dependencies are replaced with implementation .
  • Update all the dependencies in your project. Because if one of your dependencies compile your project will show this error. Therefore, update all dependency versions.
+3
source

go to the build.gradle file at the project level, you will see the following lines:

 dependencies { classpath 'com.android.tools.build:gradle:3.1.4' //place your cursor over here //and hit alt+enter and it will show you the appropriate version to select // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files classpath 'com.google.gms:google-services:4.0.2' //the same as previously } 
+2
source

In my case, it was an old dependency that used compilation for transitive dependencies: com.jakewharton.hugo

After removing it from my gradation, it compiled.

+2
source

The workaround to solve this problem was that I used an older version of Gradle, which can be found here :

I used gradle version -3.0-rc-1-src, but others can work too, although it probably shouldn't be newer than version 3.0.

First, unzip the zip file anywhere.

Then go to File → Settings → Build, Run, Deployment → Gradle and change the Use local Gradle distribution option. After that, make sure that the Gradle Home-field points to the .gradle directory in the directory you just unpacked.

Restore the project and everything will be in order.

+1
source

In my case, if I delete → apply the plugin: com.google.gms.google-services' <- this line, the warning error is not displayed, but the application cannot initiate firebase, therefore the application fails

0
source

I tried changing google gms services to the latest com.google.gms:google-services:3.2.1 in Android Studio 3.0.1, but the warning still persists.

As the compiler recommended, I changed all the compile dependencies to implementation and testCompile to testImplementation like this.

 dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support:mediarouter-v7:27.1.1' implementation 'com.android.support:design:27.1.1' implementation 'com.google.firebase:firebase-ads:12.0.1' implementation 'com.google.firebase:firebase-crash:12.0.1' implementation 'com.google.firebase:firebase-core:12.0.1' implementation 'com.google.firebase:firebase-messaging:12.0.1' implementation 'com.google.firebase:firebase-perf:12.0.1' implementation 'com.google.firebase:firebase-appindexing:12.0.1' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } 

And finally, the warning is removed!

0
source

You can do the following two options:

  1. Add classpath 'com.google.gms: google-services: 3.2.0' in the ur project: build.gradle and
  2. Replace your module: build.gradle depending on your implementation, and you will not receive any warning messages.
0
source

Just add from build.gradle from build script

 classpath 'com.google.gms:google-services:3.2.0' 

and all dependencies "compile" replaced by "implementation" .

it worked from me.

0
source

Current version 4.2.0 :

buildscript {

 repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.4.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files classpath 'com.google.gms:google-services:4.2.0' } 

}

0
source

For me, changing compilation to implementation fixed this

Front

 compile 'androidx.recyclerview:recyclerview:1.0.0' compile 'androidx.cardview:cardview:1.0.0' //Retrofit Dependencies compile 'com.squareup.retrofit2:retrofit:2.1.0' compile 'com.squareup.retrofit2:converter-gson:2.1.0' 
After

After

 implementation 'androidx.recyclerview:recyclerview:1.0.0' implementation 'androidx.cardview:cardview:1.0.0' //Retrofit Dependencies implementation 'com.squareup.retrofit2:retrofit:2.1.0' implementation 'com.squareup.retrofit2:converter-gson:2.1.0' 
0
source

Hope you suffered from build.gradle (app). If so, do the next step.

Replace compilation with androidTestImplementation in build.gradle

 androidTestImplementation 'com.android.support:appcompat-v7:27.1.1' androidTestImplementation 'com.android.support:design:27.1.1' 

so simple ! hope it solves

-2
source

In my case, the problem was the Google services gradient plugin with the following line in the gradle file:

apply plugin: 'com.google.gms.google-services'

Removing this resolved the issue.

-3
source

go to you build.gradle (application level)

Build.gradle module application

and replace the word “compile” with the words “implementation”,

it will work 100%

-7
source

Source: https://habr.com/ru/post/1276153/


All Articles