簡體   English   中英

清單文件中有多個元數據

[英]Having multiple meta-data in Manifest file

在我的應用程序中,我正在使用一項或多項服務,因此我在manifest包含了元數據。 但是我的問題是,僅使用一個元標記可以正常工作,但是具有多個標記則會引發錯誤。
這是我的Manifest.xml

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="place.picker.mymarket">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme">
    <activity android:name=".oneTimeValidation">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".MainActivity" />
    <activity android:name=".MapsActivity"/>
    <activity android:name=".list_my_posts" android:label="deletion list" />
    <activity android:name=".Upload_to_server"></activity>
    <meta-data android:name="com.google.android.geo.API_KEY"
    android:value="@string/google_place_api" />
    <meta-data
    android:name="com.google.android.geo.API_KEY1"
    android:value="@string/google_maps_key" />
</application>
</manifest>

它拋出錯誤

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs

任何人都可以幫助我如何在清單中包含多個meta標簽。

打開清單,然后單擊合並清單

在此處輸入圖片說明

在右列,您將找到有關該錯誤的更多詳細信息,例如以下消息。

在此處輸入圖片說明

我認為在只需要它們時都聲明它們都不是一個好主意,但是如果您仍然有機會仍要聲明它們,則只需使用一個密鑰即可。 一把鑰匙將同時適用於這兩種服務。

<meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="@string/google_places_api_key" />    

<meta-data
    android:name="com.google.android.geo.API_KEY"
    android:value="@string/google_places_api_key" />  

希望對您有幫助。

您不能同時在清單中聲明兩個鍵。 當您使用Google Maps和Google Places時,僅使用Google Places API密鑰( com.google.android.geo.API_KEY ),即可同時使用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM