26

I am getting a warning about the usage of deprecated features in my build.
Is there a way to list all the deprecated features so that I may go through and update my code?

*clarification

I know I can go to the Gradle documentation and see what is now deprecated, what I would specifically like is a way to go through MY code and list MY deprecated features.

Ola Ström
  • 4,136
  • 5
  • 22
  • 41
Ed Dunn
  • 1,152
  • 3
  • 11
  • 27

4 Answers4

38

I just faced the exact same problem and running the Gradle build task every time through the command line wasn't the best option for me because, during development, I usually just use the built-in Gradle build task run, so:

I know I can go to the Gradle documentation and see what is now deprecated, what I would specifically like is a way to go through MY code and list out MY deprecated features.

You can do this by adding the mentioned --warning-mode=all flag to your gradle command line options in your Android Studio settings:

enter image description here This will print the proper warnings for you to be aware of what are the specific deprecated features your app is using.

Also, I know you asked this near a year ago, but, it might be useful for other people facing the same issue.

Hugo Allexis Cardona
  • 1,382
  • 19
  • 25
  • 1
    In simple IDEA (not Android Studio) the section is located in _Build, Execution, Deployment -> Gradle-Android Compiler_. Not sure it will help in such case, though. The answer below worked for my non-android project. – Klesun Dec 05 '19 at 14:53
  • I tried this, but now I don't get the warning about deprecated gradle settings any more. Even after removing the command line option again, I get no warnings any more. where should they be shown? – rubo77 Feb 02 '20 at 18:55
  • This did not work for me. I stopped getting the message about deprecation warnings that were not being shown, but the actual deprecations were still not shown. @tangens answer below did work for me. – Greg Apr 23 '21 at 22:22
  • Doesn't seem like this works any more. I still get that same message recommending I show warnings. (Also not sure why a command line compiler option would change a gradle sync issue, but I don't know much about gradle.) I also tried @tangens' answer which didn't work. – Prime624 Apr 07 '22 at 05:48
18

In order to change the warning verbosity level in the Android Studio IDE, you can add the option org.gradle.warning.mode=(all,none,summary) to the gradle.properties file, which can be found in the root directory of your project.

Add following line to set the warning mode to all:

...
org.gradle.warning.mode=all
...
tangens
  • 665
  • 2
  • 11
  • 17
12

Use Gradle option -Dorg.gradle.warning.mode=(all,none,summary) to control verbosity, for example, mode all will log all warnings with detailed descriptions:

./gradlew build -Dorg.gradle.warning.mode=all

More details can be found in the official documentation: Showing or hiding warnings

VaL
  • 1,128
  • 15
  • 29
  • Probably I'm running the wrong command (or at the wrong location), but in PowerShell I get: _Task '.gradle.warning.mode=all' not found in root project '....'._ I am attempting `gradle -Dorg.gradle.warning.mode=all` – Steven Jeuris Jul 20 '18 at 13:32
  • No clue why, but [only the other notation](https://docs.gradle.org/4.8.1/userguide/command_line_interface.html#sec:command_line_warnings) (`--warning-mode=all`) works for me. Don't you love frameworks that allow the same thing to be done in two separate ways (without documenting why), and seemingly only one of the two options works? – Steven Jeuris Jul 20 '18 at 13:45
0
  1. Go to the build.Gradle (Module) file.
  2. replace Compile with implementation.
  3. Sync the gradle file and you will not receive the warning again.
Mukesh Chauhan
  • 791
  • 8
  • 9