Android Studio 3 not marking deprecated methods anymore

Viewed 2003

I've noticed after the update to Android Studio 3 (but it could be happened also before and I didn't noticed) that some deprecated methods are not marked any more with a line-through. For example:

Code screenshot

I'm on Ubuntu, Android Studio 3.0.1 just updated. I checked inspections in the settings, and it's all enabled. I also checked that the code style/formatting is correctly set-up for deprecations (but it had to be, given the last line of the example is correctly marked). It's not something project-related, since I tried on a freshly created project.

What can cause this?

1 Answers

I finally discovered that this is (strangely) the intended behaviour: https://issuetracker.google.com/65793314

What's your minSdkVersion? It's a feature that we now only show deprecated method calls as deprecated if they're deprecated for all the versions you're trying to target

So, getColor() and isAnimationCacheEnabled() are not marked in my example because I'm targeting API 15+, and instead they're deprecated as of API 23. I confirmed this raising my app's minSdkVersion to 23, and they are all marked now.

Anyway I find this behaviour confusing and unnecessary, like I said in the bug report. If someone read this and agrees, please leave a comment there.

Related