Search code examples
androidunity-game-enginemanifestpublish

Unity Android manifest merge error


I'm trying to build my app for Android, but I keep getting these error messages which are on the picture. Since I'm beginner in programming, I have no idea what is wrong. Two manifest files are following: 1)

    <?xml version="1.0" encoding="utf-8"?>
<!--
This Google Mobile Ads plugin library manifest will get merged with your
application's manifest, adding the necessary activity and permissions
required for displaying ads.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.google.unity"
    android:versionName="1.0"
    android:versionCode="1">
  <uses-sdk android:minSdkVersion="9"
      android:targetSdkVersion="19" />
  <!-- Google Mobile Ads Permissions -->
  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
  <!-- Uncomment to add billing for in-app purchase ads -->
  <!--<uses-permission android:name="com.android.vending.BILLING"/> -->
  <application>
    <!-- Denote the referenced Google Play services version -->
    <meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    <!-- Google Mobile Ads Activity -->
    <activity android:name="com.google.android.gms.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
        android:theme="@android:style/Theme.Translucent" />
    <!-- InAppPurchase Activity -->
    <activity android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
        android:theme="@style/Theme.IAPTheme"/>
  </application>
</manifest>

2)

    <?xml version="1.0" encoding="utf-8"?>
<!--
This Google Mobile Ads plugin library manifest will get merged with your
application's manifest, adding the necessary activity and permissions
required for displaying ads.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.admob.demo"
    android:versionName="1.0"
    android:versionCode="1">
  <uses-sdk android:minSdkVersion="9"
      android:targetSdkVersion="19" />
  <!-- Google Mobile Ads Permissions -->
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" />
  <!-- Uncomment to add billing for in-app purchase ads -->
  <!--<uses-permission android:name="com.android.vending.BILLING"/> -->
  <application>
   <activity
            android:name="com.unity3d.player.UnityPlayerActivity"
            android:label="activetitle" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    <!-- Denote the referenced Google Play services version -->
    <meta-data android:name="com.google.android.gms.version"
        android:value="8115000" />
    <!-- Google Mobile Ads Activity -->
    <activity
             android:name="com.google.android.gms.ads.AdActivity"
             android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
             android:theme="@android:style/Theme.Translucent" />
  </application>
</manifest>

What I tried, was to change minimum API level from build settings, but it didn't help. I will also add screen from build settings, if you know how to fix it, then I would be really grateful!

build settings are these errors are these


Solution

  • You have repeated lines in the manifest that can cause the manifest merge to fail as it doesn't know which one to keep. If the error persists, please copy the full error message in your post.

    Remove this from your manifest 2:

     <meta-data android:name="com.google.android.gms.version"
            android:value="8115000" />
        <!-- Google Mobile Ads Activity -->
        <activity
                 android:name="com.google.android.gms.ads.AdActivity"
                 android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
                 android:theme="@android:style/Theme.Translucent" />
    

    EDIT:

    To fix the problem with this plugin https://github.com/googleads/googleads-mobile-unity

    The easiest way is to go to Assets -> Play Services Resolver -> Android Resolver -> Resolve client jars

    That should update all your libraries and dependencies of your project, please make sure you have latest version of the plugin which is 3.2.0 as of today.