How one can get rid of linter deprecation warnings? For example, the annoying NetworkInfo
:
warning: [deprecation] NetworkInfo in android.net has been deprecated
In order to get rid of such deprecation warnings, when providing backwards compatibility,
one has to remove the import
, to which one cannot apply @SuppressWarnings("deprecation")
:
// import android.net.NetworkInfo;
And then use it's fully qualified class name android.net.NetworkInfo
instead of NetworkInfo
. The point is, that one can only apply @SuppressWarnings("deprecation")
to methods, but not imports.