使用库在AndroidManifest.xml [英] uses-library in AndroidManifest.xml
问题描述
我现在有这在我的AndroidManifest.xml
I currently have this in my AndroidManifest.xml
使用库机器人:名字=com.google.android.maps机器人:所需=FALSE
谷歌地图API的规定要求不是强制性的。 (这使我能够在一个没有,谷歌的API仿真器上安装我的应用程序)
The specified requirement of google map api is not compulsory. (This enables me to install my application on an none-google-api emulator)
不过,这仅适用于API 7级,2.1平台
它不会对API级别4,平台1.6工作
However, this only works for API level 7, Platform 2.1 It doesn't work for API level 4, Platform 1.6
我收到的时候我编译错误消息 - 未找到属性资源标识符需要,在包'机器人'
I am getting an error message when I am compiling - " No resource identifier found for attribute 'required" in package 'android'
但是,当我在这里看到的文档:
http://developer.android.com/guide/topics/manifest /uses-feature-element.html
But, when I looked at the documentation here: http://developer.android.com/guide/topics/manifest/uses-feature-element.html
必要的属性,因为4级介绍。
The attribute 'required' is introduced since level 4.
有人能帮帮我!
由于Aillyn
我觉得这是不可能的,包括在使用图书馆标签要求的属性。
I think it impossible to include required attribute in uses-library tag.
有没有一种方法,包括在java code,而不是在AndroidManifest.xml ??
Is there a way to include uses-library in the java code rather than in the AndroidManifest.xml??
推荐答案
看起来像Android的文档得到了更新:
Looks like Android doc got updated:
属性:
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/专题/清单/使用库-element.html
这篇关于使用库在AndroidManifest.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!