76

I am getting the following message when I compile an Android Studio project:

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.

How do I add the '--warning-mode all' command line setting to my Android Studio project so I can find the deprecated feature?

Steve A
  • 1,798
  • 4
  • 16
  • 34
  • 1
    You can refer [this](https://stackoverflow.com/a/54680263/4693331) post. Hope it will help you. – Arti Patel Feb 20 '19 at 07:09
  • 2
    Possible duplicate of [Gradle: List deprecated features](https://stackoverflow.com/questions/49304438/gradle-list-deprecated-features) – superjos May 23 '19 at 20:25
  • @Artipatel uh, just noticed your comment here, after answering with the same suggestion – superjos May 23 '19 at 20:26

5 Answers5

69

Just create a file called gradle.properties in your root project:

root 
|--gradle.properties 
|--build.gradle 
|--app 
|----build.gradle

Then add inside that file:

org.gradle.warning.mode=(all,none,summary)

Sascha N.
  • 65
  • 1
  • 6
Zain Ali
  • 15,535
  • 14
  • 95
  • 108
  • 10
    Thanks, working, but this must be an incredibly ridiculous way of doing it? Is there really not available a setting somewhere? It is 2019! – carl May 09 '19 at 13:00
  • Thanks, this is exactly what i was looking for =) – OlegKrikun Oct 28 '19 at 16:32
  • 2
    @carl I believe this is a great solution. It allows you to share this important setting on version control with your whole team to avoid the "works on my machine" problem. And the IDE is picking it up automatically, which is great too. I imagine IntelliJ could have a setting that would generate this file for you. – Martín Coll Sep 04 '20 at 15:46
  • This solution doesn't work for me with with latest Android Studio and Gradle versions. Fortunately, @Superjos's answer works like a charm. – steph643 May 19 '21 at 08:27
  • 4
    Installed AS and Gradle latest last month. When I click Build->Clean_Project it reported `Value '(all,none,summary)' given for org.gradle.warning.mode Gradle property is invalid`. The root gradle.properties file was already there, as I expected. What worked instead was: `org.gradle.warning.mode=all` – John Aug 15 '21 at 10:33
  • 3
    @John you have to choose between all, none or summary – ansh sachdeva Aug 18 '21 at 10:17
48

Please have a look at this older SO question, in particular this answer.

Just pasting the same picture here, but credits should go to original answer author:

Settings\Compiler, Command-line Options

superjos
  • 12,189
  • 6
  • 89
  • 134
  • 2
    I recommend Zain's answer when working in a team with version control, as that one allows everyone to build using the same settings. E.g I have `org.gradle.warning.mode=fail` and I want that to happen in my machine, my coworkers machine, the CI machine, etc. – Martín Coll Sep 04 '20 at 15:51
  • This one about version control is quite a sensible aspect to take into account, definitely – superjos Sep 04 '20 at 16:49
  • 1
    @MartínColl if you share the project settings, this one is stored "For currrent project", so you should be able to share it across the computers, I guess (not expert in version control environments, just saying it might be possible) – Edw590 Jan 06 '22 at 21:45
25

Add this

org.gradle.warning.mode=all

in Gradle Scripts -> gradle.properties(Project Properties) enter image description here

Vidyesh Churi
  • 1,899
  • 1
  • 24
  • 33
2

This error is currently being caused by the shutdown of jcenter.

"The RepositoryHandler.jcenter() method has been deprecated. This is scheduled to be removed in Gradle 8.0. JFrog announced JCenter's shutdown in February 2021. Use mavenCentral() instead. Consult the upgrading guide for further information: https://docs.gradle.org/7.0.2/userguide/upgrading_version_6.html#jcenter_deprecation"

Paul Smith
  • 166
  • 3
  • 13
2

In Gradle 7.3.3. , You can just write in the Terminal

 .\gradlew --warning-mode all

or

.\gradlew --stacktrace
Mori
  • 2,653
  • 18
  • 24