Unable to merge android manifests. Trying to merge incompatible element

Hi,

I’m trying to build my app for Android but for some reason I’m getting three errors, something to do with the android manifests. I’ve tried everything I could find on the internet, but nothing has worked. Here is the biggest error:

CommandInvokationFailure: Unable to merge android manifests. See the Console for more details. 
C:/Program Files/Java/jdk1.8.0_92\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Algis/Documents/android-sdk	ools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

stderr[
Error: [Temp\StagingArea\AndroidManifest-main.xml:4, C:\Users\Algis\Desktop\Fact or Lie\Fact or Lie\Temp\StagingArea\android-libraries\google-play-services_lib\AndroidManifest.xml:4] Trying to merge incompatible /manifest/application/activity[@name=com.unity3d.player.UnityPlayerActivity] element:
  <activity
--    @android:label="@string/app_name"
--    @android:name="com.unity3d.player.UnityPlayerActivity">
--    <intent-filter>
  <activity
++    @android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale"
++    @android:label="@string/app_name"
++    @android:launchMode="singleTask"
Error: [Temp\StagingArea\AndroidManifest-main.xml, C:\Users\Algis\Desktop\Fact or Lie\Fact or Lie\Temp\StagingArea\android-libraries\play-services-ads-lite-9.4.0\AndroidManifest.xml:10] Trying to merge incompatible /manifest/application/activity[@name=com.google.android.gms.ads.AdActivity] element:
  <activity
--    @android:name="com.google.android.gms.ads.AdActivity">
--</activity>
--(end reached)
  <activity
++    @android:name="com.google.android.gms.ads.AdActivity"
++    @android:theme="@android:style/Theme.Translucent">
++</activity>
]
stdout[
Warning: [Temp\StagingArea\AndroidManifest-main.xml:1, C:\Users\Algis\Desktop\Fact or Lie\Fact or Lie\Temp\StagingArea\android-libraries\google-play-services_lib\AndroidManifest.xml:14] Main manifest has <uses-feature android:glEsVersion='0x00010000'> but library uses glEsVersion='0x00020000'
Note: main manifest lacks a <uses-feature android:glEsVersion> declaration, and thus defaults to glEsVersion=0x00010000.
[Temp\StagingArea\AndroidManifest-main.xml:4, C:\Users\Algis\Desktop\Fact or Lie\Fact or Lie\Temp\StagingArea\android-libraries\GoogleMobileAdsPlugin\AndroidManifest.xml:4] Skipping identical /manifest/application/activity[@name=com.unity3d.player.UnityPlayerActivity] element.
[Temp\StagingArea\AndroidManifest-main.xml, C:\Users\Algis\Desktop\Fact or Lie\Fact or Lie\Temp\StagingArea\android-libraries\play-services-ads-lite-9.4.0\AndroidManifest.xml:11] Skipping identical /manifest/application/activity[@name=com.google.android.gms.ads.purchase.InAppPurchaseActivity] element.
[Temp\StagingArea\AndroidManifest-main.xml, C:\Users\Algis\Desktop\Fact or Lie\Fact or Lie\Temp\StagingArea\android-libraries\play-services-base-9.4.0\AndroidManifest.xml:4] Skipping identical /manifest/application/activity[@name=com.google.android.gms.common.api.GoogleApiActivity] element.
[Temp\StagingArea\AndroidManifest-main.xml, C:\Users\Algis\Desktop\Fact or Lie\Fact or Lie\Temp\StagingArea\android-libraries\play-services-basement-9.4.0\AndroidManifest.xml:5] Skipping identical /manifest/application/meta-data[@name=com.google.android.gms.version] element.
]
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.HostView:OnGUI()

A bit background on what Unity does when you build your project:
For Android projects, Unity uses a pre-built Android “project” structure, with a manifest, libraries, etc.

Unity also allows you to add a custom Android manifest, and to use android libraries (.aar files or Android Library projects that are folders with a specific structure and contents).

When building your project, it has to merge all manifests together to form a single manifest for the app. Usually, this process works fine but in some cases it may fail (as in your case).

When manifest merging fails, Unity outputs a message that shows you what went wrong. For example, in your case:

Error:
[Temp\StagingArea\AndroidManifest-main.xml,
C:\Users\Algis\Desktop\Fact or
Lie\Fact or
Lie\Temp\StagingArea\android-libraries\play-services-ads-lite-9.4.0\AndroidManifest.xml:10]
Trying to merge incompatible
/manifest/application/activity[@name=com.google.android.gms.ads.AdActivity]
element: @android:name=“com.google.android.gms.ads.AdActivity”>
– --(end reached) @android:name=“com.google.android.gms.ads.AdActivity”
++ @android:theme=“@android:style/Theme.Translucent”>
++ ]

This error means that:

  1. Some element is defined twice (e.g: in 2 different AndroidManifest.xml files)
  2. …and that it is defined differently somehow, so the merger doesn’t know how to merge it into a single entry.

In your example - you can see that you have 2 different definitions of the com.google.android.gms.ads.AdActivity activity. in one of them some more information is provided (e.g: theme) while in the other it is not present.

You should look at these errors and find out why you have duplicate definitions of these elements (activities) and eliminate these duplications.

NOTE: I provide a service for fixing Android build issues with Unity. In any cases where you cannot resolve this issue yourself, you can always contact me :slight_smile:

Hello. I have the SAME problem.
Then Only in one of my 3 AndroidManifest I have this :

I eliminated this. (The repeat appear in Temp folder.

Then Error disapear… but…Interstitials Ads don’t load!
Then I still have a problem!

Update play service resolver.