简体   繁体   English

AndroidManifest.xml中的uses-library

[英]uses-library in AndroidManifest.xml

I currently have this in my AndroidManifest.xml 我目前在AndroidManifest.xml中有这个

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

The specified requirement of google map api is not compulsory. Google Map API的指定要求不是强制性的。 (This enables me to install my application on an none-google-api emulator) (这使我能够在none-google-api仿真器上安装我的应用程序)

However, this only works for API level 7, Platform 2.1 It doesn't work for API level 4, Platform 1.6 但是,这仅适用于API级别7,平台2.1 ,不适用于API级别4,平台1.6

I am getting an error message when I am compiling - " No resource identifier found for attribute 'required" in package 'android' 编译时收到错误消息- “在程序包“ android”中找不到属性“ required”的资源标识符

But, when I looked at the documentation here: http://developer.android.com/guide/topics/manifest/uses-feature-element.html 但是,当我在这里查看文档时: http : //developer.android.com/guide/topics/manifest/uses-feature-element.html

The attribute 'required' is introduced since level 4. 从级别4开始引入属性“必需”。

Could somebody help me out! 有人可以帮帮我!


Thanks Aillyn 谢谢艾琳

I think it impossible to include required attribute in uses-library tag. 我认为不可能在uses-library标签中包含必填属性。

Is there a way to include uses-library in the java code rather than in the AndroidManifest.xml?? 有没有办法在Java代码中而不是在AndroidManifest.xml中包含uses-library?

Looks like Android doc got updated: 看起来Android文档已更新:

attributes: 属性:

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 http://developer.android.com/guide/topics/manifest/uses-library-element.html

uses-library has no required attribute. uses-library没有required属性。 From Android docs : 来自Android文档

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

And you should use that for Google maps. 您应该将其用于Google地图。 From Google's docs: 根据Google的文档:

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

The one that has the required attribute is uses-feature 具有required属性的属性是uses-feature

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

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

相关问题 AndroidManifest.xml中的uses-library标签与Gradle中的useLibrary - uses-library tag in AndroidManifest.xml vs useLibrary in Gradle AndroidManifest.xml中的uses-library的Android Custom SDK问题 - Android Custom SDK issue with uses-library in AndroidManifest.xml 如何让我的JAR库包含在 <uses-library> 在AndroidManifest.xml中并将其用作共享库 - How to make my JAR library to be included in the <uses-library> in AndroidManifest.xml and use it as a shared library 使用 <uses-library> 在AndroidManifest文件中仅适用于特定设备 - Using <uses-library> in AndroidManifest file only for specific devices 在androidmanifest.xml中忽略了Uses_​​permission - Uses_permission ignored in androidmanifest.xml AndroidManifest.xml; 无法包含外部库 - AndroidManifest.xml; unable to include external library 引用AndroidManifest.xml中的库项目 - Referencing a library project in AndroidManifest.xml 文件“root/AndroidManifest.xml”使用保留文件或目录名称“AndroidManifest.xml” - File 'root/AndroidManifest.xml' uses reserved file or directory name 'AndroidManifest.xml' <uses-library />在Android Manifest中 - <uses-library /> in Android Manifest AndroidManifest.xml验证错误和应用无法识别使用:权限 - AndroidManifest.xml validation errors and app not recognizing uses:permission's
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM