代码之家  ›  专栏  ›  技术社区  ›  Raj kumar

清单文件中有多个元数据

  •  2
  • Raj kumar  · 技术社区  · 7 年前

    在我的应用程序中,我使用了一个或多个服务,因此我在我的应用程序中包含了元数据 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
    

    谁能帮我如何在清单中有多个元标记吗。

    3 回复  |  直到 7 年前
        1
  •  4
  •   flipbox    7 年前

    我不认为在你只需要一个键的时候同时声明这两个键是好主意,但如果你还想这样做,就用一个键。一键对两种服务都有效。

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

    希望对你有帮助。

        2
  •  2
  •   Hoshouns    7 年前

    打开清单并单击合并清单

    enter image description here

    在右栏中,您将找到有关错误的更多详细信息,如以下消息。

    enter image description here

        3
  •  1
  •   Gaurav    7 年前

    不能同时在清单中声明两个密钥。当您使用Google Maps和Google Places时,只需使用Google Places API键( 通用域名格式。谷歌。安卓地理位置。API_密钥 ),这对双方都有效。