UnityのAndroidビルドでGradleエラー


UnityでAndroidをビルドしようとしたらGradleエラーが発生した原因のメモ

エラー発生時の画面



Editor.log

CommandInvokationFailure: Gradle build failed. 
C:/Program Files/Unity/Hub/Editor/2019.4.1f1/Editor/Data/PlaybackEngines/AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2019.4.1f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

stderr[

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\develop\Unity\���{��t�H���_\BuildTest\Temp\gradleOut\launcher\build.gradle' line: 3

* What went wrong:
A problem occurred evaluating project ':launcher'.
> Failed to apply plugin [id 'com.android.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

原因

プロジェクトの作成フォルダのパスに日本語が含まれていたためでした。
次のようなパスでプロジェクトを作成しています。

C:\develop\Unity\日本語フォルダ\BuildTest

日本語を含まないパスでビルドすれば成功しました。