Unity3d Android构建错误

时间:2018-05-02 20:01:05

标签: android unity3d build

我收到以下错误。问题在哪里?

Java jdk 10.0.1。我看过所有类似的问题,但根本没有答案。

CommandInvokationFailure: Gradle build failed. 
C:/Program Files/Java/jdk-10.0.1\bin\java.exe -classpath "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '10.0.1'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
]
stdout[

]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1 progress, System.String error)
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action`1 progress)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (System.String workingdir, System.String task, System.Action`1 progress)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

2 个答案:

答案 0 :(得分:1)

似乎团结有一些问题与jdk 10,很多人有jdk 10有这个问题,但它可以通过安装jdk 8解决。 我试过这个并且也为我工作过。

答案 1 :(得分:0)

您必须更新Gradle version from here (latest jar file version),替换当前的Gradle jar文件:

  

C:\程序   文件\统一\编辑\数据\ PlaybackEngines \ AndroidPlayer \工具\ gradle这个\ lib中\ gradle这个-发射-4.X.X.jar

然后更新类路径,它应该工作