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\tools" -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
ps I also stepped back to GVR 1.0 and was able to build. You can get GVR 1.0 here:
Actually, it fixed the not-being-able-to-build problem; however, the android app that i built doesn't run at all on my Nexus 5x; crashes immediately.
So back to the drawing board, still need a way to build properly with the latest GVR libs and Unity 5.5.
Anyone succeeding?
$$anonymous$$e too HAVE THE SA$$anonymous$$E PROBLE$$anonymous$$.
Same problem. I have installed latest Google SD$$anonymous$$ (Level25) but the highest available in Unity here is Level22. Why?
Answer by liortal · Dec 09, 2016 at 09:24 PM
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.
Thank You! I lost hours/days trying to resolve this; the "player settings" solution solved multiple problems. Thanks, LIOTAL.
The plugin Android $$anonymous$$anifest might be located under Assets/GoogleVR/Plugins/Android
Also, you have to edit it in the Daydream and Cardboard manifests
Answer by dmcneely · Jan 04, 2017 at 03:29 PM
@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.
Answer by davebuchhofer · Jan 26, 2017 at 06:39 PM
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 https://developers.google.com/vr/unity/release-notes 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.
Answer by michaelgold · Dec 10, 2016 at 09:33 PM
Downgrading GVR to version 1.0 fixed this for me.
How did you downgrade the SD$$anonymous$$? I couldn't find older versions anywhere.
Hi, michaelgold, could you send me the GVR 1.0 for unity please, I can't find it on the net :'( Thanks ! :)
I have the same exact error as @Octavic; i'm using Unity 5.5.0f3 and the latest Google VR library as of today. I understand @liortal's suggestion, but it is also not solving my problem.
It is actually not clear where Unity is getting these $$anonymous$$imum SD$$anonymous$$ versions from:
$$anonymous$$y understanding is that:
-"main manifest" is set with the Player settings > Other Options The highest "$$anonymous$$imimum API Level " that I can select in Unity 5.5.0f3 under Player Settings is "Android 5.1 'Lollipop' (API Level 22)".
-"library manifest" for the latest GoogleVR plugin is under Assets>Plugins>Android>Andoird$$anonymous$$anifest-Cardboard.xml This file indicates that target level is '22' in line 35:
<uses-sdk android:$$anonymous$$SdkVersion="19" android:targetSdkVersion="22" />
So it is very strange that the build error says the main manifest is at 23 and the library manifest at 24; neither seem to be at 23 or 24!
There are two other Android$$anonymous$$anifest.xml files that may be relevant: -/Applications/Unity/PlaybackEngines/AndroidPlayer/Apk/Android$$anonymous$$anifest.xml (this file doesn't indicate $$anonymous$$imum api target levels)
-~/Library/Android/sdk/tools/apps/SD$$anonymous$$Controller/Android$$anonymous$$anifest.xml (this one indicates [android:$$anonymous$$SdkVersion="19"] and [android:targetSdkVersion="22"]
I would LOVE to know where unity is getting 23 and 24 as target levels; they don't seem to be in ANY of my Android$$anonymous$$anifest.xml files!
Here is the Unity package that I used:
https://www.dropbox.com/s/2q7x1qo628rbcy0/GoogleVRForUnity-1.0.unitypackage?dl=0