2010-08-09 68 views
0

我现在有这在我的AndroidManifest.xml使用库在AndroidManifest.xml

使用库机器人:名字=“com.google.android.maps”机器人:要求=“假”

谷歌地图API的指定要求不是强制性的。 (这使我安装我上的没有,谷歌的API仿真应用程序)

不过,这只适用于API级别7,平台2.1 它不会对API级别4,工作平台1.6

我收到的时候我编译错误消息 - “没有资源标识符发现属性“需要”在包‘机器人’

但是,当我看着文档的位置: http://developer.android.com/guide/topics/manifest/uses-feature-element.html

属性'required'自4级开始引入。

有人能帮助我!


感谢Aillyn

我认为这是不可能的,包括在应用库标签要求的属性。

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

回答

2

uses-library没有required属性。 From Android docs

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

而且您应该将其用于Google地图。从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"] /> 
+0

是的你是对的,但我能够把平台2.1所需的属性 – 2010-08-09 00:49:19

+1

@ TS.xy你不应该。 – Aillyn 2010-08-09 01:14:17

+0

谢谢Aillyn,有没有办法在Java代码而不是AndroidManifest.xml中使用libarary? – 2010-08-09 01:47:28

3

看起来像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