Minimum SDK、Target SDK、Compile SDK区分

卜瀚漠
2023-12-01
官方描述:
  • Minimum Required SDK is the lowest version of Android that your app supports, indicated using the API level. To support as many devices as possible, you should set this to the lowest version available that allows your app to provide its core feature set. If any feature of your app is possible only on newer versions of Android and it's not critical to the app's core feature set, you can enable the feature only when running on the versions that support it (as discussed in Supporting Different Platform Versions). Leave this set to the default value for this project.
  • Target SDK indicates the highest version of Android (also using the API level) with which you have tested with your application.

    As new versions of Android become available, you should test your app on the new version and update this value to match the latest API level in order to take advantage of new platform features.

  • Compile With is the platform version against which you will compile your app. By default, this is set to the latest version of Android available in your SDK. (It should be Android 4.1 or greater; if you don't have such a version available, you must install one using the SDK Manager). You can still build your app to support older versions, but setting the build target to the latest version allows you to enable new features and optimize your app for a great user experience on the latest devices.
1.Minimum SDK Version:app支持的最低版本,低于这个版本的设备无法运行你的app;所以尽量使这个版本能小于等于市场近乎100%的设备Android版本.
 2.  Target SDK Version:app支持的最高版本,运行时api版本,向前兼容;最好使用最新版本,每次使用最新版本时都需要测试;
 3.  Compile SDK Version:编译时SDk, 最好使用最新版本;如果你的Target SDK Version低于最新Version,但你又要使用该版本之后的新特性,你可       以使用Support Library ,那么你的 Compile SDK Version就是你的新特性的version。
综合来看:
minSdkVersion <= targetSdkVersion <= compileSdkVersion

最好:
minSdkVersion (lowest possible) <= targetSdkVersion == compileSdkVersion (latest SDK)
用较低的 minSdkVersion 来覆盖最大的人群,用最新的 SDK 设置 target 和 compile 来获得最新特性。
转自:

 类似资料: