【移动开发】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 specifyingtargetSdkVersion
to 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_CODES
reference.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 ...
随机推荐
- .Net Core 学习之路-AutoFac的使用
本文不介绍IoC和DI的概念,如果你对Ioc之前没有了解的话,建议先去搜索一下相关的资料 这篇文章将简单介绍一下AutoFac的基本使用以及在asp .net core中的应用 Autofac介绍 组 ...
- [LeetCode] Valid Triangle Number 合法的三角形个数
Given an array consists of non-negative integers, your task is to count the number of triplets chose ...
- 一个web程序员的年终总结
2017年年终总结(就是一个程序员的瞎叨叨): 从来到中科院到现在,很开心可以在这留下来.毕竟对于我来说,这里符合我对自己毕业后前两年的规划.我是一个很慢的人,特别是对于我想做好的事情,我会非常认真仔 ...
- 以 Angular 的姿势打开 Font-Awesome
环境 Angular: v5.2.9 Font-Awesome: v5.0.10 angular-fontawesome: v0.1.0-9 无须再用传统的 Web Font 方式 以前习惯于 Fon ...
- Shell自学之运算符和echo(W3C)
上面理论知识,最下面有我做的测试的例子: 10.Shell运算符 expr是一款表达式计算工具,使用它能完成表达式的求值操作 例:val=`expr 2 + 2`;echo "${val}& ...
- [HNOI 2004]宠物收养场
Description 凡凡开了一间宠物收养场.收养场提供两种服务:收养被主人遗弃的宠物和让新的主人领养这些宠物. 每个领养者都希望领养到自己满意的宠物,凡凡根据领养者的要求通过他自己发明的一个特殊的 ...
- [NOI2016]循环之美
Description 牛牛是一个热爱算法设计的高中生.在他设计的算法中,常常会使用带小数的数进行计算.牛牛认为,如果在 k 进制下,一个数的小数部分是纯循环的,那么它就是美的.现在,牛牛想知道:对 ...
- [JLOI2011]飞行路线
Description Alice和Bob现在要乘飞机旅行,他们选择了一家相对便宜的航空公司.该航空公司一共在n个城市设有业务,设这些城市分别标记为0到n-1,一共有m种航线,每种航线连接两个城市,并 ...
- 线性规划与网络流24题●09方格取数问题&13星际转移问题
●(做codevs1908时,发现测试数据也涵盖了1907,想要一并做了,但因为“技术”不佳,搞了一上午) ●09方格取数问题(codevs1907 方格取数3) 想了半天,也没成功建好图: 无奈下 ...
- 【luogu3384】【模板】树链剖分
省选被暴虐,成功爆0...顺便ditoly差点全省总分Rank1 orz..... 于是开始赶进度学新算法.... 然后决定开始学习树剖orz... 发现树剖很好用啊!!!! 然后做了模板题. 题目就 ...