- Home /
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\tools" -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()
Answer by liortal · Sep 21, 2016 at 08:17 PM
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:
Some element is defined twice (e.g: in 2 different AndroidManifest.xml files)
...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 :)
I think I'm making some progress but I keep getting this error that isn't allowing me to build the program:
Error: [Temp\StagingArea\Android$$anonymous$$anifest-main.xml, C:\Users\Algis\Desktop\Fact or Lie\Fact or Lie\Temp\StagingArea\android-libraries\play-services-ads-lite-9.6.0\Android$$anonymous$$anifest.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>
Could you help me out and tell me how I could fix this? I would buy your service but I can't in this case.
Did you read my answer above? you have 2 definitions of the same activity - com.google.android.gms.ads.AdActivity
One is included in play-services-ads-lite-9.6.0.aar (this is a .zip file with a different extension. it includes its own manifest inside). The other copy has to be somewhere in the project. i cannot see it in the error message your provided, but you should look for it in other manifests.
You're awesome! I had a google play services lib folder hidden in my project, and when I deleted the program started building like normal. Thank you so much!
Sorry, I'm not educated on these matters. I got rid of the errors by deleting the play-services-ads-lite .aar package, however I'm still getting one error that I have no idea on how to fix.
http://pastebin.com/hDfWkZyg (Too long to post in this)
Any clues? Appreciate it, will mark your answer as the best answer whenever I get this build working, quite frustrating.
the message is truncated (see at its ending). you should open the editor log and paste that on pastebin (in the console window -> top right corner there's a smaller button, open the editor log from it)
$$anonymous$$y bad, thanks. http://pastebin.com/v4$$anonymous$$emyG$$anonymous$$ Hope this is good.
@liortal I am very very beginner to Unity and zero in coding.. I just create builds. I am getting similar error, can you please help me below is my error in console : CommandInvokationFailure: Unable to merge android manifests. See the Console for more details. /Library/Java/JavaVirtual$$anonymous$$achines/jdk1.8.0_111.jdk/Contents/Home/bin/java -Xmx2048$$anonymous$$ -Dcom.android.sdkmanager.toolsdir="/Users/mangoreader/Android/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -
stderr[
]
stdout[
Warning: [Temp/StagingArea/Android$$anonymous$$anifest-main.xml:60, /Users/mangoreader/Desktop/Repo/livelike-unity/LivelikeV2/Temp/StagingArea/android-libraries/LocalyticsConfig/Android$$anonymous$$anifest.xml:3] $$anonymous$$ain manifest has <uses-sdk android:targetSdkVersion='23'> but library uses targetSdkVersion='24'
]
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String error$$anonymous$$sg)
UnityEditor.Android.AndroidSD$$anonymous$$Tools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memory$$anonymous$$B, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String error$$anonymous$$sg)
UnityEditor.Android.AndroidSD$$anonymous$$Tools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memory$$anonymous$$B, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String error$$anonymous$$sg)
UnityEditor.HostView:OnGUI()
Hey Thanks man, it got resolved on updating my android studio
Answer by Gurosoft · Sep 28, 2017 at 02:09 PM
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!
Your answer
Follow this Question
Related Questions
Silent Android build failure 7 Answers
il2cpp android build error unity 2019.1.6f1 6 Answers
Android Build Fail, CommandInvokationFailure 1 Answer
Unity Android IL2CPP Build Error 1 Answer
Android build error: unrecognized pixel format 264 0 Answers