我目前在AndroidManifest.xml
中有此功能uses-library android:name =“com.google.android.maps”android:required =“false”
google map api的指定要求不是强制性的。 (这使我能够在非google-api模拟器上安装我的应用程序)
但是,这仅适用于API级别7,平台2.1 它不适用于API级别4,平台1.6
我在编译时收到错误消息 - “在'android'包中找不到属性所需的资源标识符
但是,当我在这里查看文档时: http://developer.android.com/guide/topics/manifest/uses-feature-element.html
从4级开始引入'required'属性。
有人能帮助我吗?
谢谢Aillyn
我认为在uses-library标签中包含必需属性是不可能的。
有没有办法在java代码中包含uses-library而不是在AndroidManifest.xml中?
答案 0 :(得分:3)
看起来Android doc已更新:
属性:
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
答案 1 :(得分:2)
uses-library
没有required
属性。来自Android docs:
<uses-library android:name="string" />
你应该将它用于谷歌地图。来自Google's docs:
<uses-library android:name="com.google.android.maps" />
具有required
属性的属性为uses-feature
<uses-feature android:glEsVersion="integer"
android:name="string"
android:required=["true" | "false"] />