Android开发-API指南-<uses-library>

<uses-library>

英文原文:http://developer.android.com/guide/topics/manifest/uses-library-element.html
采集(更新)日期:2014-7-10
搬迁自原博客:http://blog.sina.com.cn/s/blog_48d491300100zmwz.html

Google Play 过滤机制

Google Play 利用 Manifest 文件中声明的 <uses-library> 元素进行过滤,
使得无法满足应用程序对链接库需求的设备就无法安装该应用程序。
关于过滤机制的详细信息,请参阅文章Google Play 过滤器

语法:

<uses-library
  android:name="string"
  android:required=["true" | "false"] /> 

包含于:
<application>
说明:
定义应用程序必须链接的公共库。 本元素把程序包的类装载器中需要包含的库代码通知系统。

所有的 android 包(比如 android.appandroid.contentandroid.viewandroid.widget )都包含在默认库中,所有的应用程序都会自动进行链接。 不过有些包(比如 maps)位于单独的库中,他们不会被自动链接进来。 请参阅所用包的文档,以确定其代码包含于哪个库中。

本元素还会影响应用程序在某些设备上的安装,以及在 Google Play 上的可用性:

安装
如果给出了本元素,并且其 android:required 属性设为 truePackageManager 系统将只允许在提供本库的设备上安装该应用程序。

android:required 属性将在后续章节详细说明。

属性:
android:name
库的名称。该名称在所用包的文档中给出。 例如,“android.test.runner”是包含了 Android 测试类的包。
android:required
布尔值,指明应用程序是否必需由 android:name 指定的库:

  • "true":缺少此库的话,应用程序就无法正常运行。系统将不允许应用程序在不提供此库的设备上安装。
  • "false":库存在的话,应用程序就会使用,但它设计时是考虑缺少此库也能正常工作的。 即使此库不存在,系统也允许安装应用程序。 如果用了“false”,那就必须在运行时检查此库是否可用。

    为了检查库的存在性,可以用反射来确定某个类是否可用。

默认值是“true”。

引入自 API 级别 7 。

引入自:
API 级别 1
参阅:
时间: 2024-08-27 19:57:24

Android开发-API指南-<uses-library>的相关文章

Android开发-API指南-&lt;application&gt;

<application> 英文原文:http://developer.android.com/guide/topics/manifest/application-element.html 采集(更新)日期:2014-5-30 更新下老的文档,祝贺下自己 42 岁的生日. 搬迁自原博客:http://blog.sina.com.cn/s/blog_48d491300100zmga.html 语法: <application android:allowTaskReparenting=[&q

Android开发-API指南-&lt;provider&gt;

<provider> 英文原文:http://developer.android.com/guide/topics/manifest/provider-element.html 采集(更新)日期:2014-7-1 搬迁自原博客:http://blog.sina.com.cn/s/blog_48d491300100zmv5.html 语法: <provider android:authorities="list" android:enabled=["true&

Android开发-API指南-&lt;uses-feature&gt;

<uses-feature> 英文原文:http://developer.android.com/guide/topics/manifest/uses-feature-element.html 采集(更新)日期:2014-7-7 搬迁自原博客:http://blog.sina.com.cn/s/blog_48d491300100zmwf.html 在本文中 Google Play 和基于设备特性的过滤机制 基于显式声明的特性需求进行过滤 基于隐含的特性需求进行过滤 对蓝牙特性的特殊处理 对应用

Android开发-API指南-应用程序开发基础

Application Fundamentals 英文原文:http://developer.android.com/guide/components/fundamentals.html 采集日期:2014-04-16 搬迁自原博客:http://blog.sina.com.cn/s/blog_48d491300101h41p.html 在本文中 应用程序组件 激活组件 Manifest 文件 声明组件 声明应用程序的需求 应用程序资源 Android 应用程序是用 Java 语言编写的.And

Android开发-API指南-&lt;compatible-screens&gt;

<compatible-screens> 英文原文:http://developer.android.com/guide/topics/manifest/compatible-screens-element.html 采集(更新)日期:2014-6-30 搬迁自原博客:http://blog.sina.com.cn/s/blog_48d491300100zmub.html 语法: <compatible-screens> <screen android:screenSize=

Android开发-API指南-任务和回退栈

Task 和 Back Stack 英文原文: http://developer.android.com/guide/components/tasks-and-back-stack.html 采集(更新)日期:2014-12-16 在本文中 保存 Activity 状态 管理多个 Task 指定启动模式 处理 affinity 清理回退栈k 启动任务 相关文章 Multitasking the Android Way 参阅 Android 设计 : 导航 <activity> manifest

【最后一篇API译文】Android开发-API指南- Contacts Provider

Contacts Provider 今年加入了某字幕组,加之杂事颇多,许久未添新文了,惭愧之极. 在听闻 Google 即将重返中国后,近日忽又发现官方网站正在放出 API 中文版,比如本文.当然不是大家所译,但至少句子结构较通顺,窃以为比 MSDN 中文版好些.虽有些生硬(比如将 Provider 译为“提供者”,有趣得紧),但好在前无古人,也许 Google 自此便统一了自己的中文术语也未可知.能让更多的国人精确领悟 Android 的精髓,肯定是好事,希望 Google 继续坚持. 这事应

Android开发-API指南-服务

Service 英文原文:http://developer.android.com/guide/components/services.html 采集(更新)日期:2014-12-23 原博客:http://blog.sina.com.cn/s/blog_48d49130010102pn.html 在本文中 概述 在manifest中声明服务 创建一个started服务 扩展IntentService类 扩展Service类 启动一个服务 终止一个服务 创建一个bound服务 向用户发送通知 在

Android开发-API指南-&lt;service&gt;

<service> 英文原文:http://developer.android.com/guide/topics/manifest/service-element.html 采集(更新)日期:2014-7-2 搬迁自原博客:http://blog.sina.com.cn/s/blog_48d491300100zmva.html 语法: <service android:enabled=["true" | "false"] android:expor

Android开发-API指南-&lt;receiver&gt;

<receiver> 英文原文:http://developer.android.com/guide/topics/manifest/receiver-element.html 采集(更新)日期:2014-7-2 搬迁自原博客:http://blog.sina.com.cn/s/blog_48d491300100zmv7.html 语法: <receiver android:enabled=["true" | "false"] android:ex