質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
ビルド

ソースコードを単体で実行可能なソフトウェアへ変換する過程をビルド(build)と呼びます

Unity

Unityは、Unity Technologiesが開発・販売している、IDEを内蔵するゲームエンジンです。主にC#を用いたプログラミングでコンテンツの開発が可能です。

Gradle

Gradleは、ビルド自動化ツールです。 ソフトウェアパッケージやドキュメント、 または実際に何か他の種類のプロジェクトの構築、テスト、公開、展開などを自動化が出来ます

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Q&A

解決済

1回答

7590閲覧

Unity2019 3.7f ビルドで失敗するため、解決策をご教示ください。

unity_level1

総合スコア8

ビルド

ソースコードを単体で実行可能なソフトウェアへ変換する過程をビルド(build)と呼びます

Unity

Unityは、Unity Technologiesが開発・販売している、IDEを内蔵するゲームエンジンです。主にC#を用いたプログラミングでコンテンツの開発が可能です。

Gradle

Gradleは、ビルド自動化ツールです。 ソフトウェアパッケージやドキュメント、 または実際に何か他の種類のプロジェクトの構築、テスト、公開、展開などを自動化が出来ます

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

0グッド

0クリップ

投稿2020/06/09 05:06

Unity 2019 3.7fでBuildを行いたいのですが、以下のようなエラーにより、Buildがうまくいかない状況です。

当方Unity開発初心者でして、AndroidへのBuildも今回が初のため、稚拙な質問をしておりましたらご容赦頂ければ幸いです。

現在の環境

■開発OS Windows 10

■Unityバージョン:Unity2019 3.7f
下記モジュール追加済み
Android Build Support
Android SDK & NDK Tools
OpenJDK

■Android Studio 4.0

■UnityのBuildの際の設定値
・BuildSetting
Platform - Android
Export Project - チェック ※参照した記事の手順にのっとっております。

・Preferences External Tools(SDK、NDK、JDK)
イメージ説明
※こちらは、デフォルトから変更はしていません。

・PlayetSetting
Package Name ‐ 設定済み

実施した内容

下記でバージョンアップしているGradleはExportしたゲームプロジェクトに格納されているGradleをバージョンアップしております。

下記記事のGradle build failedが出る(Unity2019から)を参考にして、
Android Studio用にExportし、ExportしたファイルをAndroidStudioで読み込み、
Gradleをアップグレードしました。

・Gradleのバージョン(1回目)
gradle-wrapper.properties(Gradle Vesion)の
distributionUrl=https://services.gradle.org/distributions/gradle-5.6.4-all.zip

バージョンアップ後、AndroidStudio内で、インポート(Android Studio用にExportしたゲームファイル)をRetryしたところ、成功しました。

・Gradleのバージョン(2回目)
gradle-5.6.4へバージョンアップしたところ、おそらく現在の最新ではなかったため、再度更新しますか?と聞かれたので、最新にしておこうと思い、6.1.1へバージョンアップを実行しました。
※ここでエラーが発生しました。エラーの詳細は以降で記載します。

・エラーは出ておりましたが、Gradleはバージョンアップできているように見受けられたため、Unityを記事の指示通り、
Export Projectのチェックを外して、Buildしましたがエラーが解消されず失敗しました。
Gradleは下記の設定のものがgradle-wrapper.properties(Gradle Vesion)に記載されておりました。
distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip

参照記事
【Unity2019対応】Androidビルドでエラーが出る場合の対処法

発生しているエラー

■Unity上のエラー

・Export Projectのチェックをしない場合 ※チェックした場合は、成功してファイルが作成されます。

エラー①
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

エラー②
FAILURE: Build failed with an exception.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

エラー③
Where:
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

エラー④
Build file 'D:\�Q�[���J��\�׋�\�m��Q�[�����f��\Temp\gradleOut\launcher\build.gradle' line: 3
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

エラー⑤
What went wrong:
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

エラー⑥
A problem occurred evaluating project ':launcher'.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

エラー⑦

Failed to apply plugin [id 'com.android.application']

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

エラー⑧

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.

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

エラー⑨
Try:
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

エラー⑩
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.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

エラー⑪
Get more help at https://help.gradle.org
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

エラー⑫
BUILD FAILED in 2s
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

エラー⑬
CommandInvokationFailure: Gradle build failed.
C:/Program Files/2019.3.7f1/Editor/Data/PlaybackEngines/AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\2019.3.7f1\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 'D:\�Q�[���J��\�׋�\�m��Q�[�����f��\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.

BUILD FAILED in 2s
]
stdout[

]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <88091cc0f6184c3ca77702906799aea5>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <88091cc0f6184c3ca77702906799aea5>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <88091cc0f6184c3ca77702906799aea5>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1[T] progress, System.String error) (at <88091cc0f6184c3ca77702906799aea5>:0) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action1[T] progress) (at <88091cc0f6184c3ca77702906799aea5>: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 <88091cc0f6184c3ca77702906799aea5>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <88091cc0f6184c3ca77702906799aea5>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <88091cc0f6184c3ca77702906799aea5>: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 <88091cc0f6184c3ca77702906799aea5>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <88091cc0f6184c3ca77702906799aea5>: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 <88091cc0f6184c3ca77702906799aea5>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <88091cc0f6184c3ca77702906799aea5>: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 <78f1ad0f25c84e3ca853e639f50d95f5>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

エラー⑭
Build completed with a result of 'Failed' in 22 seconds (22056 ms)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

エラー⑮
UnityEditor.BuildPlayerWindow+BuildMethodException: 19 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002bb] in <78f1ad0f25c84e3ca853e639f50d95f5>:0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <78f1ad0f25c84e3ca853e639f50d95f5>:0
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

■AndroidStudio上のエラー

・Gradleのバージョンアップ(2回目)を行った際に発生
おそらく、Android SDKのファイルパスが異なっているのかなと考えております。

Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;29.0.2 Android SDK Build-Tools 29.0.2
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

Using Android SDK: C:\Program Files\2019.3.7f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK
Install missing SDK package(s)

気になる点

AndroidStudioのbuild.gradle(Project ゲームファイル名) 内のスクリプトに記載されているGradleのバージョン?classpath'com.android.tools.build:gradle:4.0.0'となっており、gradle:4.0.0がバージョンになっているように見受けられます。
これはバージョンアップが適用していないのでしょうか?

長々と申し訳ございませんが、現バージョンでビルドが行うことが目的のため、上記エラー以外でも
何かご存じの方おりましたら、ご教示のほどよろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

プロジェクトのパスにASCII文字以外を使っている可能性が高いです、文字化けを直してみてください。
'D:\�Q�[���J��\�׋�\�m��Q�[�����f��\Temp\gradleOut\launcher\build.gradle'
ファイルパスに日本語があるとエラーの原因になります。

投稿2020/06/09 06:02

harunasan

総合スコア125

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

unity_level1

2020/06/09 06:28

harunasanさん 本件、ご回答いただきありがとうございました。 ご指摘いただきました通り、ASCⅡ以外の文字を使用していたため、発生したエラーでした。 直したところ、エラーは解消され、ビルドが行えました。 大変助かりました。ありがとうございました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問