• Register
0 votes
83 views

Problem :

I have already replaced every occurrence of a compile by implementation in the project's build.gradle, but I am still facing below warning :

Warning: configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'

I also tried to look for a "compile" in a whole project but no match was found. So what is the cause of the warning?

7 5 2
3,870 points

Please log in or register to answer this question.

2 Answers

0 votes

Solution :

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

Please find below code for your reference :

 

buildscript {

repositories {

        google()

        jcenter()

    }

    dependencies {

        classpath 'com.android.tools.build:gradle:3.1.0'



    // NOTE: Do not place the application dependencies here; they belong

    // in a individual module build.gradle files



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

    }

}

OR

I encounter same problem without using com.google.gms:google-services. A solution solving this kind problem is as follows:

1. Please check your build.gradle files of all projects and modules. Or you can just global search with key word 'compile' to find where is a cause of  this warning.

2. If above method is unable to solve your warning, then use a  CLI Command,  ./gradlew assembleDebug -d > gradle.log
need to print detail debug information to the file named gradle.log or any else, as a information is too much. Then search the word "WARNING" to find a position in a gradle.log, usually by this way you can find what dependence or plugin causing the warning.

9 7 4
38,600 points
0 votes

Solution:

I've 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'
    }
}

 or You can do this way : Follw the below steps

1) Use the new dependency configurations in gradle file Replace ‘compile’ with an ‘implementation’
dependencies {
    compile 'com.android.support:support-v4:27.0.3'
}

this should be like :

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

2) And Replace ‘testCompile’ with an ‘testImplementation’.

testCompile 'junit:junit:4.12'

this should be like :

testImplementation 'junit:junit:4.12'

3) For library replace compile with api

4) 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)

5) File -> Invalidate Cache

 
10 6 4
31,120 points

Related questions

0 votes
2 answers 876 views
876 views
Problem : Currently I am using the Android Studio 2.1 but when I try to run it the suddenly my App shows me the below error Message my Gradle Build saying the following Exception is: org.gradle. ... .execute(SkipEmptySourceFilesTaskExec uter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.j ava:52)
asked Jan 31, 2020 jwilliam 3.9k points
0 votes
1 answer 464 views
464 views
Problem : I am facing the gradle error at the building from few days it just came randomly. My project depends on the multiple libraries and it built without the problems until few days (even with a libraries) ... .gradle.api.internal.changedetection.state.CacheLockReleasingTaskExecuter$1.run(CacheLockReleasingTaskExecuter.java:40) at org.gradle.internal.Factories$1.create(Factories.java:26)
asked Jan 30, 2020 jwilliam 3.9k points
0 votes
1 answer 636 views
636 views
Problem : When I try to build my app, I face follow error : Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. More than one file was found with OS independent path 'META-INF/LICENSE' When I try to add below code ... .LeakCanary.isInAnalyzerProcess(LeakCanary.java:145) at cn.sz.cyrus.wemz.TestApplication.onCreate(TestApplication.kt:32) Who knows how to solve this?
asked Jan 21, 2020 jwilliam 3.9k points
0 votes
1 answer 510 views
510 views
Problem : Recently I have updated to Android Studio 3.1. But my project is not running anymore. I have searched for the solution all over the internet with zero positive results. Below is the error that I get in my Logcat: “Java.lang.noclassdeffounderror: ... sdk:4.+'     implementation 'com.parse:parsefacebookutils-v4-android:1.10.3@aar'     implementation 'com.commit451:PhotoView:1.2.4' }
asked Jan 30, 2020 jwilliam 3.9k points
0 votes
2 answers 65 views
65 views
Problem : After updating my android studio to android studio 2.3 I facing below error message. I know it is giving me just the hint as my app is running normally but it looks really strange. “All com.android.support libraries must use the exact same version ... 1, 24.0.0. Examples include com.android.support:animated-vector-drawable:25.1.1 and com.android.support:mediarouter-v7:24.0.0”
asked Jan 9, 2020 alecxe 7.5k points
1 vote
1 answer 343 views
343 views
Problem : After updating my android studio, I am facing below error. How can I fix this error?? org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures. at org.gradle ... .execute(SessionFailureReportingActionExecuter.java:63) at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:53)
asked Dec 11, 2019 alecxe 7.5k points
0 votes
1 answer 185 views
185 views
Problem: Currently I am trying to explore gradle and my question may be naive. I have already noted from my gradle docs about below the plugin- apply plugin: 'application' The Application plugin facilitates creating an executable JVM application. It makes ... make a jar runnable or creating executable the JVM application. Does that clearly mean skipping does not make a application executable ?
asked Jul 8, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 41 views
41 views
Problem : Recently I had preinstalled my laptop and then switched to Windows 10. Before that I had saved my project in the Android Studio 2.2.3 and then I downloaded the same version of the Android Studio after I completed the preinstallation of my laptop, but if I ... . Blockquote I had tried all of the steps mentioned by Android Studio to resolve the error but I am still facing the same issue.
asked Feb 22, 2020 mphil 2.3k points
0 votes
1 answer 57 views
57 views
Problem : I am new to Android. Recently I have installed the Android studio 3.1.3 and it started giving me the dependencies error if tried to make the new project and tried to compile for the first time. “Unable to resolve dependency for ':app@debug/compileclasspath': could not resolve project”
asked Feb 18, 2020 mphil 2.3k points
0 votes
1 answer 699 views
699 views
Problem : I have got the following gradle FAILURE message: ..."Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0." My Case description as follows: · I had attached to the project codebase the next libs: APP/build. ... test and got the FAILURE message as follows. Deprecated gradle features were used in this build, making it incompatible with gradle 5.0.
asked Nov 21, 2019 peterlaw 6.9k points