我知道在 Gradle 中生成拆分时有一个排除 ABI 的选项,如下所示:
android {
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86 and x86_64.
// Resets the list of ABIs that Gradle should create APKs for to none.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "x86", …
Run Code Online (Sandbox Code Playgroud) 所以,我有一段代码看起来像
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2){
// Do something
} else {
//Do something else
}
Run Code Online (Sandbox Code Playgroud)
但Android Studio向我显示了以下针对我的if
子句的警告:
Unnecessary; SDK_INT is always >= 21
,虽然我已经minSdkVersion
设置为16.
那么,为什么我会收到这个警告,即使Build.VERSION_CODES.JELLY_BEAN_MR2 = 18
我最终可能会遇到这个if
子句必须有用的场景(例如16和17 SDK版本)?