28

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.

4 Answers 4

40

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.

4
  • 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
    Commented Dec 5, 2019 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
    Commented Feb 2, 2020 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
    Commented Apr 23, 2021 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
    Commented Apr 7, 2022 at 5:48
19

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
...
2
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

2
  • 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 <taskname> -Dorg.gradle.warning.mode=all Commented Jul 20, 2018 at 13:32
  • No clue why, but only the other notation (--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? Commented Jul 20, 2018 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.