您的位置:首页 > 移动开发 > Android开发

【Android】SDK和API Level版本的对应关系

2015-11-24 11:08 225 查看
这里记录一下android的SDK和API版本号之间的对应关系,方便以后的查看。

官方API Level地址: https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels

平台版本API 级别VERSION_CODE备注
Android 7.024
N
平台亮点
Android 6.023
M
平台亮点
Android 5.122
LOLLIPOP_MR1
Android 5.021
LOLLIPOP
Android 4.4W20
KITKAT_WATCH
仅限 KitKat for Wearables
Android 4.419
KITKAT
平台亮点
Android 4.318
JELLY_BEAN_MR2
平台亮点
Android 4.2、4.2.217
JELLY_BEAN_MR1
平台亮点
Android 4.1、4.1.116
JELLY_BEAN
平台亮点
Android 4.0.3、4.0.415
ICE_CREAM_SANDWICH_MR1
平台亮点
Android 4.0、4.0.1、4.0.214
ICE_CREAM_SANDWICH
Android 3.213
HONEYCOMB_MR2
Android 3.1.x12
HONEYCOMB_MR1
平台亮点
Android 3.0.x11
HONEYCOMB
平台亮点
Android 2.3.4 Android 2.3.310
GINGERBREAD_MR1
平台亮点
Android 2.3.2 Android 2.3.1 Android 2.39
GINGERBREAD
Android 2.2.x8
FROYO
平台亮点
Android 2.1.x7
ECLAIR_MR1
平台亮点
Android 2.0.16
ECLAIR_0_1
Android 2.05
ECLAIR
Android 1.64
DONUT
平台亮点
Android 1.53
CUPCAKE
平台亮点
Android 1.12
BASE_1_1
Android 1.01
BASE


举例

例如以下的 build.gradle 配置文件指定了项目兼容的最低android API版本号:
minSdkVersion 16
,那么该项目兼容的系统版本就是Android 4.1.2以上的机型。

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
applicationId "com.example.cook"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}


不过一般Android 应用开发该用哪个版本的 SDK 呢?

Google官方强烈建议,永远只用最新的SDK版本。你的app能运行的Android版本不是由SDK决定的,是由每一个项目的minSDK决定的。

In order to provide the best user experience on the latest devices, we recommend that you use the latest platform version as your build target. You’ll still be able to run your app on older versions, but you must build against the latest version in order to use new features when running on devices with the latest version of Android.To get started, download the latest Android version, plus the lowest version you plan to support (we recommend Android 2.2 for your lowest version).

【参考资料】:

http://developer.android.com/sdk/installing/adding-packages.html#Recommended
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: