繁体   English   中英

AndroidManifest.xml中的uses-library

[英]uses-library in AndroidManifest.xml

我目前在AndroidManifest.xml中有这个

Uses-library android:name =“ com.google.android.maps” android:required =“ false”

Google Map API的指定要求不是强制性的。 (这使我能够在none-google-api仿真器上安装我的应用程序)

但是,这仅适用于API级别7,平台2.1 ,不适用于API级别4,平台1.6

编译时收到错误消息- “在程序包“ android”中找不到属性“ required”的资源标识符

但是,当我在这里查看文档时: http : //developer.android.com/guide/topics/manifest/uses-feature-element.html

从级别4开始引入属性“必需”。

有人可以帮帮我!


谢谢艾琳

我认为不可能在uses-library标签中包含必填属性。

有没有办法在Java代码中而不是在AndroidManifest.xml中包含uses-library?

看起来Android文档已更新:

属性:

android:required
    Boolean value that indicates whether the application requires the library specified by android:name:

        "true": The application does not function without this library. The system will not allow the application on a device that does not have the library.
        "false": The application can use the library if present, but is designed to function without it if necessary. The system will allow the application to be installed, even if the library is not present. If you use "false", you are responsible for checking at runtime that the library is available.

        To check for a library, you can use reflection to determine if a particular class is available.

    The default is "true".

    Introduced in: API Level 7.

http://developer.android.com/guide/topics/manifest/uses-library-element.html

uses-library没有required属性。 来自Android文档

<uses-library android:name="string" />

您应该将其用于Google地图。 根据Google的文档:

<uses-library android:name="com.google.android.maps" />

具有required属性的属性是uses-feature

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM