uses-library

语法(SYNTAX):

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

被包含于(CONTAINED IN):

<application>

说明(DESCRIPTION):

这个元素用于指定该应用程序必须链接的共享类库。这个元素告诉系统该应用程序包的类装载器中所包含的类库代码。

Android的所有包(如andorid.app,android.content,android.view和android.widget等)都在应用程序自动链接的默认类库中。但是,有些包是在于独立的类库中,它们不能被自动的链接到应用程序包中,要查看这些包的文档,以确定要把哪些类库包含到包的代码中。

这个元素也会影响该应用程序在特殊设备上的安装,以及应用程序在Google Play上的可用性。

安装(Installation)

如果在该应用的清单中出现这个元素,并且它的android:required属性被设置为true,那么除非该类库在用户的设备上存在,否则PackageManager框架不会让用户安装这个应用程序。

Google Play

Google Play会基于要安装在用户设备上的类库来过滤应用程序。有关过滤的更多信息,请看Filters on Google Play(http://developer.android.com/guide/appendix/market-filters.html

属性(ATTRIBUTES):

android:name

这个属性用于指定类库的名称。这个名称是在对应的类库文档中提供的。例如:android.test.runner库就是包含Android测试类的一个程序包。

android:required

这个属性用于指定应用程序是否需要有android:name属性所指定的类库:

true:没有这个库应用程序无法工作。如果用户设备设备上没有这个类库,系统不允许该应用程序安装在这个设备上。

false:如果该类库存在,则应用程序能够使用这个类库,但是如果有必要,也可以设计成没有该类库,应用程序也能够工作。系统会允许应用程序安装,即使该类库不存在。如果使用false,就要在运行时对类库的有效性进行必要的检查。

对于类库的检查,可以使用反射机制来判断一个具体的类是否有效。

默认值是true。

这个属性在API Level 7中被引入。

被包含于(INTRODUCED IN):

API Level 1

FAILED: out_system/target/common/obj/APPS/SprdDialer_intermediates/enforce_uses_libraries.status /bin/bash -c "(rm -f out_system/target/common/obj/APPS/SprdDialer_intermediates/enforce_uses_libraries.status ) && (build/soong/scripts/manifest_check.py --enforce-uses-libraries --enforce-uses-libraries-status out_system/target/common/obj/APPS/SprdDialer_intermediates/enforce_uses_libraries.status --aapt out_system/host/linux-x86/bin/aapt2 --uses-library com.unisoc.sdk.common --uses-library org.apache.http.legacy --dexpreopt-config out_system/target/product/ussi_arm64/obj/JAVA_LIBRARIES/com.unisoc.sdk.common_intermediates/dexpreopt.config out_system/target/common/obj/APPS/SprdDialer_intermediates/manifest/AndroidManifest.xml )" error: mismatch in the <uses-library> tags between the build system and the manifest: - required libraries in build system: [com.unisoc.sdk.common, org.apache.http.legacy] vs. in the manifest: [com.unisoc.sdk.common, org.apache.http.legacy] - optional libraries in build system: [] vs. in the manifest: [androidx.window.extensions, androidx.window.sidecar] - tags in the manifest (out_system/target/common/obj/APPS/SprdDialer_intermediates/manifest/AndroidManifest.xml): <uses-library android:name="com.unisoc.sdk.common" android:required="true"/> <uses-library android:name="org.apache.http.legacy" android:required="true"/> <uses-library android:name="androidx.window.extensions" android:required="false"/> <uses-library android:name="androidx.window.sidecar" android:required="false"/> note: the following options are available: - to temporarily disable the check on command line, rebuild with RELAX_USES_LIBRARY_CHECK=true (this will set compiler filter "verify" and disable AOT-compilation in dexpreopt) - to temporarily disable the check for the whole product, set PRODUCT_BROKEN_VERIFY_USES_LIBRARIES := true in the product makefiles - to fix the check, make build system properties coherent with the manifest - for details, see build/make/Changes.md and https://source.android.com/devices/tech/dalvik/art-class-loader-context
08-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值