Android 中compiledSDKVersion,minSdkVersion,targetSdkVersion的含义

来源:互联网 发布:clock置换算法实例讲解 编辑:程序博客网 时间:2024/06/13 10:36

下面这段英文来自于官方文档的如下位置:android-sdk-windows/docs/training/basics/firstapp/creating-project.html

app/build.gradle
Android Studio uses Gradle to compile and build your app. There is a build.gradle file for each module of your project, as well as abuild.gradle file for the entire project. Usually, you're only interested in thebuild.gradle file for the module, in this case the app or application module. This is where your app's build dependencies are set, including thedefaultConfig settings:
  • compiledSdkVersion 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 this to the latest version allows you to enable new features and optimize your app for a great user experience on the latest devices.
  • applicationId is the fully qualified package name for your application that you specified during the New Project workflow.
  • minSdkVersion is the Minimum SDK version you specified during the New Project workflow. This is the earliest version of the Android SDK that your app supports.
  • targetSdkVersion indicates the highest version of Android with which you have tested 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 and thereby take advantage of new platform features. For more information, read Supporting Different Platform Versions.
         大概意思是:
 Android 系统使用gradle 来编译和构建你的应用。在你的项目的每一个module中都有一个build.gradle文件,整个项目也有一个build.gradle文件。通常情况下你只应该对module中的build.gradle感兴趣,这里指的就是我们的APP所在的module。你的应用程序如何构建将根据这个build.gradle中的设置来进行,一般build.gradle中默认包括下面的配置:
    comipledSdkVersion : 用来编译APP的android版本,通常设置为最新的版本。(你应该使用android4.1或者更新的版本,假如你没有这些版本的话,你需要安装并使用SDK manager来下载它们)。使用新的版本编译APP时,仍然支持老版本的特性。把这个值设置成最新的版本就可以允许你使用新的特性,并且可以让你的app在新版本的设备上有非常好的用户体验。
    applicationId: 项目的顶级包名。
    minSdkVersion : 指定的最小的SDK版本。就是我们的app所能支持的最老的版本。
    targetSdkVersion:我们的产品可以运行的,经过测试过的,最高的SDK版本(比如说我们的APP最高支持Android 5.0)。随着新的SDK版本的来到,你应该在新版本上测试你的app,然后更新这个值来迎合新的API,这样就可以利用新版本的特性了。


0 0
原创粉丝点击