Android Unable to merge android manifest Error

I created an empty project and imported the google library for CardBoard VR, then when I try to build I get this error:

CommandInvokationFailure: Unable to merge android manifests. See the Console for more details. 
C:/Program Files/Java/jdk1.8.0_111\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Yifei/AppData/Local/Android/sdk	ools" -Dfile.encoding=UTF8 -jar "D:\Programs\Unity2\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

stderr[

]
mp\StagingArea\AndroidManifest-main.xml:18, E:\Programming\Unity\CardBoardTest2\Temp\StagingArea\android-libraries\gvr-permissionsupport-release\AndroidManifest.xml:3] Main manifest has <uses-sdk android:targetSdkVersion='23'> but library uses targetSdkVersion='24'
]
exit code: 1
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()

I’m using 5.5.0f3 and the newest Google SDK for CardBoard. I have also updated my Android to API 23, but the problem persists

In the final .APK package, there’s only a single (1) AndroidManifest.

When building your project for Android, Unity uses a “main manifest” (default pre-made one, or a custom one, provided by you under Assets/Plugins/Android)i. If you’re adding any other plugin libraries, Unity will merge all manifests together to form a single, merged manifest for the built .APK.

In case you define multiple conflicting entries (in the main manifest vs. library manifests), Unity will generate an error such as the one you’re getting.

The error usually contains the root cause for failure, along with the paths of the manifest file).

In your case:

Main manifest has android:targetSdkVersion=‘23’> but
library uses targetSdkVersion=‘24’

Your library (Cardboard VR) specifies that the target Android SDK version that your game is compiled with is 24, but you have defined this to be 23 (in your Player Settings). There’s no automatic way that Unity could merge these values together to decide which is the correct value.

The solution:

set your minimal SDK version (Under Player Settings → Other Settings) to 24. If this is not possible, you’d have to create a custom AndroidManifest.xml and place it under Assets/Plugins/Android.

Once your main manifest matches the targetSDKVersion of the library your build should succeed.

Note: in case you’re still not able to resolve the issue yourself, please note that I offer professional services for resolving this kind of Android build issues. More info can be found in this link.

@irlab – I only changed one thing in one of the xml files and it worked for me. This one: AndroidManifest.xml in the project folder\Assets\Plugins\Android. I changed the android:targetSdkVersion=“22” to be “24”. So android:targetSdkVersion=“24”. This worked fine and I can now build.

I’ve seen this error a lot, the easiest way to find out what is causing it is to browse to the \Temp\StagingArea\android-libraries\ and check which plugins include internal manifests.

The Gvr sdk 1.10 added the gvr-permissionsupport-release plugin, per Releases · googlevr/gvr-unity-sdk · GitHub I’m taking that as PermissionsDemo (Daydream only)

If, like me, you’re trying to support both daydream and cardboard from the same project prior to 5.6, The options are: add targetSdk of 24 to your manifest, or remove this file from cardboard builds, and leave it in daydream builds.

Downgrading GVR to version 1.0 fixed this for me.

Downgrading to 1.0 did it for me as well.

This is my same problem, I’m glad to see this post and now my problem is solve.
I’ve tried changing my

<uses-sdk android:minSdkVersion="19" **android:targetSdkVersion=**"24"**** 

THANK YOU EVERYONE!!! :heart: No need to degrade gvr version.
Set SDK version what you want in the build → player settings → inspector → TARRGET SDK version to what you want. Just keep in mind that if you choose the lower versions, change the android:minSdkVersion=“__” to the lower version that what you want is so it has allowance then change the android:targetSdkVersion=“24”. That’s it!

Btw, I am using Unity 5.4.3f1 and I have created a mobile virtual reality app for a tourist destination :slight_smile:
PS. I haven’t tried it in my phone, I’ll update you when I do it.
Salamat! Mabuhay!

This is a comment in case your Android phone can’t be upgraded. My AT&T Samsung Note Edge is not getting updates anymore, so I am stuck with Android 5.1 (level 22). I get the “unable to merge android manifest errors” after the upgrade to GVR 1.30, since it requires Android 7.0 (level 24). The combination that works for me is GVR 1.20 and Unity 5.5.1f1, for Cardboard.

This may be coming late, but you can help other people out there with problem of two plugin conflicting in Androidmanifest.xml in unity project. You can check my answer to this thread, i was able to solve mine.

Problem fixed here : Manifest merger failed with multiple errors | Fix Black Screen When Using AR Foundation in Unity - YouTube