2

I got following error while making apk file from unity. I set minimum API level=19 and target 24. because I build a apk for Gear VR and I have Samsung S7 Edge.

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

stderr[ Error:Invalid command manifmerger ] stdout[

] exit code: 64 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()

Paolo Forgia
  • 6,572
  • 8
  • 46
  • 58
  • 1
    Check if there is only one `android.manifest` file in your project – Hristo Jun 06 '17 at 09:48
  • May be there should be space between "-D file.encoding=" and between "-D com.android.sdkmanager.toolsdir". – maximelian1986 Jun 06 '17 at 10:55
  • you mean that there is mistakes in sdk paths which i set i unity? please elaborate your answer i don't understand this "-D file.encoding=" and between "-D com.android.sdkmanager.toolsdir" – Geeta Parshotam Jun 06 '17 at 13:52
  • there are two manifest files one is android.manifest-main and other is android.manifest present in androidlibrary/ovrplugin help me what should i do? – Geeta Parshotam Jun 06 '17 at 14:17

3 Answers3

2

The error happens due to this Unity bug (related to the latest Android SDK tools version).

You can see in the error message that the "manifmerger" tool returns an error code (64):

stderr[ Error:Invalid command manifmerger ] stdout[

] exit code: 64

The bug is fixed in the latest Unity (beta) version. There is a workaround, as described on that page:

Workaround for the customers.

  1. just open https://developer.android.com/studio/index.html
  2. scroll down to the bottom of that page
  3. go to downloads
  4. scroll down to the bottom of that page
  5. find Windows "tools_r25.2.3-windows.zip" download and unzip it
  6. or, on mac: find MacOSX "tools_r25.2.3-macosx.zip" download and unzip it.
  7. In the SDK path replace the tools folder.

This is a quote from the issuetracker page. I've added direct links to the downloads, since they seem to be missing from the Android website.

Community
  • 1
  • 1
lysergic-acid
  • 19,570
  • 21
  • 109
  • 218
  • thanks for reply! i already tried this solution but still get same errors , if i download unity beta version so this fix my problems ? – Geeta Parshotam Jun 06 '17 at 15:38
  • This should fix your issues. I've done this for countless developers as part of my gig: https://www.fiverr.com/lysergide/fix-android-build-issues-in-your-unity3d-project you should not use the beta version (haven't tested it myself, so i am not sure it fixes the issue). – lysergic-acid Jun 06 '17 at 15:40
  • Thank you so much! you save my time , it works after replace the tools actually before i did something wrong. thanks man for help – Geeta Parshotam Jun 06 '17 at 17:18
  • great to hear. mark this as the answer so it can help others – lysergic-acid Jun 06 '17 at 19:15
0

You can try to rise up your minimum api level, usually when there is high diffrence between target devices and minimum api level Unity fail to merge android manifests.

I hope this will work your problem :)

Eren
  • 61
  • 1
  • 6
0

thank you so much guys for help!

finally i make apk file by doing the following steps.

1 just open https://developer.android.com/studio/index.html 2 scroll down to the bottom of that page go to downloads scroll down to the bottom of that page 3 find Windows "tools_r25.2.3-windows.zip" download and unzip it 4 or, on mac: find MacOSX "tools_r25.2.3-macosx.zip" download and unzip it. 5 In the SDK path replace the tools folder.