kotlin suppress warning deprecated for Android

Use @Suppress annotation with argument "DEPRECATION":

@Suppress("DEPRECATION")
someObject.theDeprecatedFunction()

Instead of a single statement, you can also mark a function, a class or a file (@file:Suppress("DEPRECATION") in its beginning) with the annotation to suppress all the deprecation warnings issued there.

In IntelliJ IDEA this can also be done through Alt+Enter menu with caret placed on code with deprecation warning.

Leave a Comment