![](/img/trans.png)
[英]uses-library tag in AndroidManifest.xml vs useLibrary in Gradle
[英]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.