【移动开发】targetSdkVersion的作用
在AndroidMenifest.xml中,常常会有下面的语句:
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="10" android:maxSdkVersion="15" />
在project.properties中,会看到下面的语句: target=android-10 如果是使用Eclipse的话,还可能会看到这样的警告:
Attribute minSdkVersion (4) is lower than the project target API level (10)
那么,这里面的minSdkVersion、maxSdkVersion、targetSdkVersion、target四个属性到底有什么区别?
project.properties中的target是指在编译的时候使用哪个版本的API进行编译。 综上,上面的四个值其实是作用于不同的时期:
这四个数值在程序编译时也没有严格的检查,比如说,你可以将minSdkVersion设置的比maxSdkVersion还大,会自动忽略掉错误的maxSdkVersion。
android:targetSdkVersion- An integer designating the API Level that the application targets. If not set, the defaultvalue equals that given to
minSdkVersion.This attribute informs the system that you have tested against the target version and thesystem should not enable any compatibility behaviors to maintain your app's forward-compatibilitywith the target version. The application is still able to run on older versions (down to
minSdkVersion).As Android evolves with each new version, some behaviors and even appearances might change.However, if the API level of the platform is higher than the version declared by your app's
targetSdkVersion, the system may enable compatibility behaviors to ensure that your appcontinues to work the way you expect. You can disable such compatibilitybehaviors by specifyingtargetSdkVersionto match the APIlevel of the platform on which it's running. For example, setting this value to "11" or higherallows the system to apply a new default theme (Holo) to your app when running on Android 3.0 orhigher and also disables screencompatibility mode when running on larger screens (because support for API level 11 implicitlysupports larger screens).There are many compatibility behaviors that the system may enable based on the value you setfor this attribute. Several of these behaviors are described by the corresponding platform versionsin the
Build.VERSION_CODESreference.To maintain your application along with each Android release, you should increasethe value of this attribute to match the latest API level, then thoroughly test your application onthe corresponding platform version.
Introduced in: API Level 4
http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
【移动开发】targetSdkVersion的作用的更多相关文章
- C#接口显示实现在实际开发中的作用
摘要 任何一个C#入门的程序员都知道——当一个类型在实现接口的时候,有两种方法实现:显式实现.隐式实现.而且大家也都知道,当一个类型实现的两个接口存在相同成员定义时,显示实现可以解决这种情况. 但是, ...
- Java动态加载类在功能模块开发中的作用
Java中我们一般会使用new关键字实例化对象然后调用该对象所属类提供的方法来实现相应的功能,比如我们现在有个主类叫Web类这个类中能实现各种方法,比如用户注册.发送邮件等功能,代码如下: /* * ...
- VS2017的MVC和Angular联合开发的配置文件作用
在通过MVC和Angular联合开发项目时,项目里有几个重要的配置文件,下面列出这几个配置文件的分析和比较: 主要配置文件有appsettings.json,tsconfig.json,package ...
- JAVA中的垃圾回收机制以及其在android开发中的作用
http://blog.csdn.net/xieqibao/article/details/6707519 这篇文章概述了JAVA中运行时数据的结构,以及垃圾回收机制的作用.在后半部分,描述了如何检测 ...
- 【视频开发】IR-CUT作用
自然界存在着各种波长的光线,通过折射人眼能看到不同颜色的光线,这就是光线的波长不同所导致的.其实还有许多光线是人眼看不到的,人眼识别光线的波长范围在320nm-760nm之间,超过760nm的光线人眼 ...
- 千位分隔符在web开发中的作用
有千位分隔符会被认为是数字,否则在移动端会被直接识别成手机号 在开发实战中主流实现方式是添加meta标签 <meta name="format-detection" cont ...
- [Unity3D]Unity3D游戏开发MatchTarget的作用攀登效果实现
大家好,我是秦培,欢迎关注我的博客.我的博客地址blog.csdn.net/qinyuanpei. 今天我们来一起学习在Unity3D中怎样实现角色攀爬效果. 在RPG游戏中,某些游戏场景经常须要玩家 ...
- 如何选择 compileSdkVersion, minSdkVersion 和 targetSdkVersion
对这几个概念模模糊糊,看到一篇文章就记录下来. 当你发布一个应用之后,(取决于具体的发布时间)可能没过几个月 Android 系统就发布了一个新版本.这对你的应用意味着什么,所有东西都不能用了?别担心 ...
- compileSdkVersion, minSdkVersion 和 targetSdkVersion的选择(copy)
英文原文:Picking your compileSdkVersion, minSdkVersion, and targetSdkVersion 作者:Ian Lake,Google Android ...
随机推荐
- 在VS2017中安装OpenGL
由于VS2017支持直接下载有关openGL的库文件,因此给我们带来了很多方便之处,不需要单独下载了. 1.打开VS2017,并新建一个C++控制台项目 2.然后点击 项目-管理Nuget程序包, 点 ...
- 【转】cookielib模块
cookielib模块 cookielib模块的主要作用是提供可存储cookie的对象,以便于与urllib2模块配合使用来访问Internet资源.例如可以利用本模块 的CookieJar类的对象来 ...
- cookie的实现原理
cookie技术通过在请求和响应报文中写入cookie信息来控制客户点的状态 cookie会根据从服务器端发送的响应报文内的一个叫做set-cookie的首部字段信息,通知客户端保存cookie 当下 ...
- 一张图片快速明白Python概述
- 确定稳定的 Spring Cloud 相关环境版本
开发部署 Spring Cloud 微服务框架,需要先确定 Spring Cloud 的相关环境版本,主要包含:Spring Cloud.Spring Cloud Netflix.JDK.JRE.Ja ...
- 使用YOLOv2进行图像检测
基本配置信息 tensorflow (1.4.0) tensorflow-tensorboard (0.4.0) Keras (2.1.5) Python (3.6.0) Anaconda 4.3.1 ...
- js将一个数组插入另一个数组
var cont =[1,2,3,4]; var res =[4,5,6] for(var i=0;i<res;i++){ cont.push( res.data.list[i]); } con ...
- 使用Remix编译和部署以太坊智能合约
Remix 是一個开源的 Solidity 智能合约开发环境,提供基本的编译.部署至本地或测试网络.执行合约等功能.Solidity 是 以太坊Ethereum 官方设计和支持的开发语言,专门用于 ...
- [SCOI 2009]windy数
Description 题库链接 找出在 \([A,B]\) 间满足相邻位差值至少为 \(2\) 的正整数个数. \(1\leq A,B\leq 2\cdot 10^9\) Solution 数位 \ ...
- 计蒜客NOIP模拟赛6 D1T1Diamond-square
Diamond-square 算法是一种能够用于生成噪声的算法,现在我们考虑这个算法的一个变种. 你有一个 2^n\times 2^n2n×2n 的网格,一共有 (2^n+1)^2(2n ...