Unity CommandInvokationFailure: Failed to sign APK package

Unity 2018无法打包了,看了前人的方法,都不好用,输出信息如下!

CommandInvokationFailure: Failed to sign APK package. 
D:\android-sdk\build-tools\28.0.3\apksigner.bat sign --ks "C:\Users\Administrator\.android\debug.keystore" --ks-pass stdin  --ks-key-alias "androiddebugkey" --key-pass stdin  "D:\working\shangqi\Temp/StagingArea/Package.apk"

stderr[
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
]
stdout[
Error occurred during initialization of VM
Could not reserve enough space for 1048576KB object heap
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.RunWithStdin (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg, System.String[] input)
UnityEditor.Android.PostProcessor.Tasks.TasksCommon.Exec (System.String command, System.String args, System.String workingdir, System.String errorMsg, System.String[] stdin)
UnityEditor.Android.PostProcessor.Tasks.BuildAPK.SignPackage (UnityEditor.Android.PostProcessor.PostProcessorContext context, System.String abi)
UnityEditor.Android.PostProcessor.Tasks.BuildAPK.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
 

关键就在于 Could not reserve enough space for 1048576KB object heap

于是找到 D:\android-sdk\build-tools\28.0.3\apksigner.bat 里面的

set defaultXmx=-Xmx1024M

改为 set defaultXmx=-Xmx512M

于是就可以正常打包了。

你可能感兴趣的:(unity3d)