3

In my application i am using one or more services so i included the meta data in my manifest. But my problem is when using only one meta tag works fine but having multiple tags throws error.
Here is my 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>

It throws Error:

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

Can Anyone help me how to have multiple meta-tags in manifest please.

AskNilesh
  • 67,701
  • 16
  • 123
  • 163
Raj kumar
  • 153
  • 4
  • 13

3 Answers3

5

I don't think it's good idea to declare both of them when you just need one, but if by any chance you still want to do it then, just use one key for it. One key will work for both service.

<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" />  

Hope it helps you.

flipbox
  • 83
  • 4
2

Open the manifest and click on Merged manifest

enter image description here

At the right column, you'll find more details about the error, something like the following message.

enter image description here

Hoshouns
  • 2,420
  • 23
  • 24
1

You can't declare both keys in your manifest in the same time. When you are using Google Maps and Google Places just use the Google Places API key only (com.google.android.geo.API_KEY), and it will work for both.

Gaurav
  • 491
  • 2
  • 8
  • 17