gpt4 book ai didi

Android minSdk 和依赖项

转载 作者:行者123 更新时间:2023-11-30 01:22:55 25 4
gpt4 key购买 nike

我读到我的应用程序将能够在最低 SDK 版本上运行,在本例中为 16:

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "com.github.dht.screenger"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
...

那么在 API 16 设备上运行时,级别 23 依赖项会发生什么?

依赖关系

compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:recyclerview-v7:23.2.0'
....

最佳答案

IT 主要取决于功能以及您是否使用了支持库,因为如果您使用了支持库中的向后兼容的功能,那么库会处理它否则 native 行为开始

Lets take the most common scenario, The status bar

在 API 级别 16 中,没有状态栏颜色着色,但显示了黑色状态栏,但从 API 21 开始,它就在那里,因为我们可以看到该特定版本的 native 行为启动

now lets see the com.android.support:recyclerview-v7:23.2.0

如您所见,v7 指定该库向后兼容至版本 API 版本 7 (ECLAIR_MR1),因此支持库会为您做到这一点。

The final case using methods available only in that particular version of SDK

发生这种情况时,编译器会抛出一个错误,提示您不能使用它,因为支持的最低版本没有此方法。

关于Android minSdk 和依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36832117/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com