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.
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.
THANK YOU EVERYONE!!! 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
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.