• Register
0 votes
44 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

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 690 views
690 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 jwilliam 3.9k points
0 votes
1 answer 385 views
385 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 jwilliam 3.9k points
0 votes
1 answer 517 views
517 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 jwilliam 3.9k points
0 votes
1 answer 373 views
373 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 jwilliam 3.9k points
0 votes
2 answers 56 views
56 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 alecxe 7.5k points