1

I'm trying to run an old project of mine on android studio, the project was last edited in 2017 and since then haven't been touched.

i keep getting an error to change the "compile" to "implementation" in the gradle file which i have done and still i keep getting the same warning

"WARNING: Configuration 'compile' is obsolete and has been replaced 
with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: 
http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: app"

this is the actual code in the gradle file

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:recyclerview-v7:27.1.1'

it should build successfully without this warning, what am i doing wrong here?

Mahmoud Omara
  • 533
  • 6
  • 22

4 Answers4

0

You can try this

Just update

com.google.gms:google-services

Aris Guimerá
  • 1,095
  • 1
  • 12
  • 27
0

Though i don't see any problem with your dependency list, use debug logs to identify which dependency is reason for this. Compile using command line and collect logs in some file.

gradlew assembleDebug --debug > abc_1.txt

println("....1")
implementation fileTree(dir: 'libs', include: ['*.jar'])
println("....2")
implementation 'com.android.support:appcompat-v7:27.1.1'
println("....3")
testImplementation 'junit:junit:4.12'
println("....4")
androidTestImplementation 'com.android.support.test:runner:1.0.2'
println("....5")
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
println("....6")
implementation 'com.android.support:appcompat-v7:27.1.1'
println("....7")
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
println("....8")
implementation 'com.android.support:recyclerview-v7:27.1.1'
println("....9")

My example output

10:22:23.633 [QUIET] [system.out] ...1
10:22:23.633 [QUIET] [system.out] ...2
10:22:23.634 [QUIET] [system.out] ...3
10:22:23.634 [QUIET] [system.out] ...4
10:22:23.634 [QUIET] [system.out] ...5
10:22:23.634 [QUIET] [system.out] ...6
10:22:23.635 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute container callback action' started
10:22:23.635 [WARN] [org.gradle.api.Project] WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
10:22:23.635 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Execute container callback action'
10:22:23.635 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute container callback action' completed
10:22:23.635 [QUIET] [system.out] ...7
10:22:23.635 [QUIET] [system.out] ...8
10:22:23.636 [QUIET] [system.out] ...9
10:22:23.636 [QUIET] [system.out] ...10
Ranjan Kumar
  • 1,164
  • 7
  • 12
0

i was using a very old version of realm in my project

classpath "io.realm:realm-gradle-plugin:2.2.1"

after updating to

classpath "io.realm:realm-gradle-plugin:5.12.0"

the warning was gone and everything working again

Mahmoud Omara
  • 533
  • 6
  • 22
-1

You can try this: Go to File > Sync project with Gradle Files

Then with the system finishes Sync

Go to File > Invalidate cache and Restart

Hope it works