1. 程式人生 > >【Android】SDK和API Level版本的對應關係

【Android】SDK和API Level版本的對應關係

這裡記錄一下android的SDK和API版本號之間的對應關係,方便以後的檢視。

這裡寫圖片描述

舉例

例如以下的 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).