So, I have a piece of code which looks something like
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2){
// Do something
} else {
//Do something else
}
But Android Studio shows me the following warning for my if
clause:
Unnecessary; SDK_INT is always >= 21
, while I have minSdkVersion
set up to 16.
So, why am I getting this warning, even though Build.VERSION_CODES.JELLY_BEAN_MR2 = 18
and I might end up with a scenario in which this if
clause must be useful (for example with 16 and 17 SDK version)?
Silly me - just realized I also have flavors and the current one has minSdkVersion = 21
. So, the check must stay to do its work for other flavors with lower minSdkVersions.
Also, that means that Lint isn't able to check different flavors and sticks with the current one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With