AndroidManifest.xml注意事项

来源:互联网 发布:另请高明知乎 编辑:程序博客网 时间:2024/05/16 00:59

http://blog.csdn.net/a345017062/article/details/8689185


一、target SDK version
Android Runtime和Dalvik会根据target SDK version决定是否工作在『兼容模式』下,所谓兼容模式,就是关闭了新版本中各种新机制和体验优化的状态。targetSdkVersion如果设置很低,就等于是关闭了所有高版本的新特性和机制,包括『屏幕自适应』、『硬件加速』。
为了保证各个版本的兼容性,及时使用到新特性,targetSdkVersion因随Android最新版本的发布而持续提高,以保证在各个Android版本的设备上都能获得完整的体验。
Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details
二、<application>中的debuggable=”true”
当debuggable打开时,除了更易暴露在攻击之下,SDK tools(包括ProGuard)也不会进行一些针对发布版本可以进行的优化,比如移除dex包中的代码调试信息(符号名、行号等),移除DEBUG和VERBOSE级别的日志输出。这些对App发布版本的容量和性能都有直接的影响。
Avoid hardcoding the debug mode; leaving it out allows debug and release builds to automatically assign one
三、 <uses-permission>写在<application>之后
表面上看没有什么问题,但却埋下了一些<application>内部属性正确生效的隐患。
The <application> tag should appear after the elements which declare which version you need, which features you need, which libraries you need, and so on. In the past there have been subtle bugs (such as themes not getting applied correctly) when the <application> tag appears before some of these other elements, so it's best to order your manifest in the logical dependency order

0 0
原创粉丝点击