概要
「Gradle build failed. See the Console for details」と出て、エラー箇所もわかりにくい。
調べると「Gradleの設定」とか出ますが、私の場合初歩的なミスだったので再発防止のためにメモしてます。
エラーコード
CommandInvokationFailure: Gradle build failed.
C:\Program Files\UnityEditor\2020.2.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\UnityEditor\2020.2.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.6.4.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
stderr[
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\user\[プロジェクトパス]\Temp\gradleOut\launcher\build.gradle' line: 3
* What went wrong:
A problem occurred evaluating project ':launcher'.
> Failed to apply plugin [id 'com.android.internal.application']
> Your project path contains non-ASCII characters. This will most likely cause the build to fail on Windows. Please move your project to a different directory. See http://b.android.com/95744 for details. This warning can be disabled by adding the line 'android.overridePathCheck=true' to gradle.properties file in the project directory.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 4s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
]
stdout[
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <5cf84f2cc5134566935b135856517214>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <5cf84f2cc5134566935b135856517214>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <5cf84f2cc5134566935b135856517214>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <5cf84f2cc5134566935b135856517214>:0)
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <5cf84f2cc5134566935b135856517214>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <5cf84f2cc5134566935b135856517214>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <5cf84f2cc5134566935b135856517214>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <5cf84f2cc5134566935b135856517214>:0)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <5cf84f2cc5134566935b135856517214>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <5cf84f2cc5134566935b135856517214>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <5cf84f2cc5134566935b135856517214>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <5cf84f2cc5134566935b135856517214>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <1e441e8684a14fe4b8f8a926d91afc3a>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
対応方法
プロジェクトのパス内に日本語が入らないようにすることで解決します。
私の環境だとデスクトップを指定すると「Desktop」ではなく「デスクトップ」となっているので、日本語名が挟まってエラーが出ていました。
投稿者プロフィール
最新の投稿
- 2023年10月9日プログラミング【ライセンス】GPL/LGPLライブラリについて
- 2023年8月19日その他【Pixiv】閲覧注意機能が反映されないときに確認すること
- 2023年4月30日プログラミング【JavaScript】ファイルの保存先をダイアログで指定する方法 – showSaveFilePicker()の使い方
- 2022年10月17日その他「NovelAI Diffusion」を使ってみた (Img2Img)
ありがとうございます! 自分の場合はドキュメントフォルダーにあったので、Cドライブ直下に移動させたら動きました!