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

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

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

AdMobは、事前に指定した条件に従ってアプリに広告を表示するGoogleのサービス。開発者の向けのサービスで、広告を掲載することにより、収益を得ることが可能です。その他、見た目や雰囲気などアプリに合う広告に変更したり、広告表示の場所を指定することもできます。

Unity3D

Unity3Dは、ゲームや対話式の3Dアプリケーション、トレーニングシュミレーション、そして医学的・建築学的な技術を可視化する、商業用の開発プラットフォームです。

Unity

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

Q&A

解決済

3回答

1383閲覧

(Unity ビルド時)Gradle build failed.のエラーの直し方を教えてください!

CPU

総合スコア13

AdMob

AdMobは、事前に指定した条件に従ってアプリに広告を表示するGoogleのサービス。開発者の向けのサービスで、広告を掲載することにより、収益を得ることが可能です。その他、見た目や雰囲気などアプリに合う広告に変更したり、広告表示の場所を指定することもできます。

Unity3D

Unity3Dは、ゲームや対話式の3Dアプリケーション、トレーニングシュミレーション、そして医学的・建築学的な技術を可視化する、商業用の開発プラットフォームです。

Unity

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

0グッド

0クリップ

投稿2023/12/10 06:52

編集2023/12/10 15:56

実現したいこと

  • エラーメッセージで書いてあるエラーを直し、ビルドが完了できるようにしたい

前提

私はAdmobを使ってUnityで広告を入れています。ビルドをしようとすると、下の画像のように表示され、Consoleにエラーメッセージが表示されました。
イメージ説明
Admobを使う前はエラーメッセージで書いたようなエラーは出ていなかったです。

エラーメッセージ

エラーメッセージ1

Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details > Configure project :launcher WARNING: The option setting 'android.enableR8=false' is deprecated. It will be removed in version 5.0 of the Android Gradle plugin. You will no longer be able to disable R8

エラーメッセージ2

FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':unityLibrary'. > Cannot change resolution strategy of dependency configuration ':unityLibrary:aarArtifacts' after it has been resolved. * 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 23s Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

エラーメッセージ3

CommandInvokationFailure: Gradle build failed. C:\Program Files\Unity\Hub\Editor\2020.3.48f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2020.3.48f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "bundleRelease" Environment Variables: USERDOMAIN = DESKTOP-7H0H2MI ProgramFiles = C:\Program Files TMP = C:\Users\81907\AppData\Local\Temp PROCESSOR_ARCHITECTURE = AMD64 PROCESSOR_REVISION = 8c01 OneDriveConsumer = C:\Users\81907\OneDrive OS = Windows_NT ALLUSERSPROFILE = C:\ProgramData PROCESSOR_IDENTIFIER = Intel64 Family 6 Model 140 Stepping 1, GenuineIntel ProgramW6432 = C:\Program Files USERPROFILE = C:\Users\81907 JAVA_HOME = C:\Program Files\Unity\Hub\Editor\2020.3.48f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK CommonProgramFiles = C:\Program Files\Common Files DriverData = C:\Windows\System32\Drivers\DriverData ComSpec = C:\WINDOWS\system32\cmd.exe PSModulePath = C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules EFC_39540 = 1 USERNAME = 81907 NUMBER_OF_PROCESSORS = 8 JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF-8 TEMP = C:\Users\81907\AppData\Local\Temp Path = C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;c:\Program Files (x86)\Symantec\VIP Access Client\;C:\Users\81907\anaconda3;C:\Users\81907\anaconda3\Library\bin;C:\Users\81907\anaconda3\condabin;C:\Users\81907\anaconda3\Scripts;C:\Program Files\Git\cmd;C:\Users\81907\AppData\Local\Microsoft\WindowsApps;;C:\Users\81907\AppData\Local\Programs\Microsoft VS Code\bin COMPUTERNAME = DESKTOP-7H0H2MI PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC SystemDrive = C: windir = C:\WINDOWS ZES_ENABLE_SYSMAN = 1 PUBLIC = C:\Users\Public CommonProgramFiles(x86) = C:\Program Files (x86)\Common Files APPDATA = C:\Users\81907\AppData\Roaming OneDrive = C:\Users\81907\OneDrive PROCESSOR_LEVEL = 6 CommonProgramW6432 = C:\Program Files\Common Files ProgramFiles(x86) = C:\Program Files (x86) SystemRoot = C:\WINDOWS SESSIONNAME = Console LOGONSERVER = \\DESKTOP-7H0H2MI LOCALAPPDATA = C:\Users\81907\AppData\Local HOMEPATH = \Users\81907 HOMEDRIVE = C: USERDOMAIN_ROAMINGPROFILE = DESKTOP-7H0H2MI ProgramData = C:\ProgramData ORIGINAL_XDG_CURRENT_DESKTOP = undefined stderr[ FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':unityLibrary'. > Cannot change resolution strategy of dependency configuration ':unityLibrary:aarArtifacts' after it has been resolved. * 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 23s Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 ] stdout[ Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details > Configure project :launcher WARNING: The option setting 'android.enableR8=false' is deprecated. It will be removed in version 5.0 of the Android Gradle plugin. You will no longer be able to disable R8 ] exit code: 1

エラーメッセージ4

Build completed with a result of 'Failed' in 117 seconds (116759 ms)

エラーメッセージ5

UnityEditor.BuildPlayerWindow+BuildMethodException: 4 errors at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002cc] in <25578071f6e44201aac745680e5c8dfc>:0 at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <25578071f6e44201aac745680e5c8dfc>:0

試したこと

まず、unityのバージョンが古いのが原因かと思い、LTSで最新のUnity2020.3.48f1に変更しました。また、AdmobのUnity Pluginはver8.6.0で最新のものを使っています。
https://developers.google.com/admob/unity/quick-start?hl=ja
上のURLを参考にしてダウンロードを行いました。
https://www.makise-lab.com/unity_2/
上のURLを見ましたが自分は英語のファイル名で作っています
https://qiita.com/tak001/items/e7a5f21742d463a37a39
次に上のURLを見ましたがUnityのAndroid SDKを使用しているので私のエラーには当てはまりませんでした

###追加情報
UnityのバージョンをUnity2023.2.2f1にすることでエラーメッセージが変わりましたので、そのエラーメッセージを下に記載しました。

エラーメッセージ1

FAILURE: Build failed with an exception. * Where: Build file 'C:\Users\81907\numberblend\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\build.gradle' line: 1 * What went wrong: A problem occurred evaluating project ':launcher'. > Failed to apply plugin 'com.android.internal.application'. > Cannot parse project property android.enableR8='' of type 'class java.lang.String' as boolean. Expected 'true' or 'false'. * 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 2s

エラーメッセージ2

CommandInvokationFailure: Gradle build failed. C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-7.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "bundleRelease" Environment Variables: USERDOMAIN = DESKTOP-7H0H2MI ProgramFiles = C:\Program Files TMP = C:\Users\81907\AppData\Local\Temp PROCESSOR_ARCHITECTURE = AMD64 PROCESSOR_REVISION = 8c01 OneDriveConsumer = C:\Users\81907\OneDrive OS = Windows_NT ALLUSERSPROFILE = C:\ProgramData PROCESSOR_IDENTIFIER = Intel64 Family 6 Model 140 Stepping 1, GenuineIntel ProgramW6432 = C:\Program Files USERPROFILE = C:\Users\81907 JAVA_HOME = C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK CommonProgramFiles = C:\Program Files\Common Files DriverData = C:\Windows\System32\Drivers\DriverData ComSpec = C:\WINDOWS\system32\cmd.exe PSModulePath = C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules EFC_39540 = 1 USERNAME = 81907 NUMBER_OF_PROCESSORS = 8 TEMP = C:\Users\81907\AppData\Local\Temp Path = C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;c:\Program Files (x86)\Symantec\VIP Access Client\;C:\Users\81907\anaconda3;C:\Users\81907\anaconda3\Library\bin;C:\Users\81907\anaconda3\condabin;C:\Users\81907\anaconda3\Scripts;C:\Program Files\Git\cmd;C:\Users\81907\AppData\Local\Microsoft\WindowsApps;;C:\Users\81907\AppData\Local\Programs\Microsoft VS Code\bin COMPUTERNAME = DESKTOP-7H0H2MI PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC SystemDrive = C: windir = C:\WINDOWS ZES_ENABLE_SYSMAN = 1 PUBLIC = C:\Users\Public CommonProgramFiles(x86) = C:\Program Files (x86)\Common Files APPDATA = C:\Users\81907\AppData\Roaming OneDrive = C:\Users\81907\OneDrive PROCESSOR_LEVEL = 6 CommonProgramW6432 = C:\Program Files\Common Files ProgramFiles(x86) = C:\Program Files (x86) SystemRoot = C:\WINDOWS SESSIONNAME = Console LOGONSERVER = \\DESKTOP-7H0H2MI LOCALAPPDATA = C:\Users\81907\AppData\Local HOMEPATH = \Users\81907 HOMEDRIVE = C: USERDOMAIN_ROAMINGPROFILE = DESKTOP-7H0H2MI ProgramData = C:\ProgramData ORIGINAL_XDG_CURRENT_DESKTOP = undefined stderr[ FAILURE: Build failed with an exception. * Where: Build file 'C:\Users\81907\numberblend\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\build.gradle' line: 1 * What went wrong: A problem occurred evaluating project ':launcher'. > Failed to apply plugin 'com.android.internal.application'. > Cannot parse project property android.enableR8='' of type 'class java.lang.String' as boolean. Expected 'true' or 'false'. * 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 2s ] stdout[ ] exit code: 1

エラーメッセージ3

Build completed with a result of 'Failed' in 72 seconds (72159 ms) 2 errors

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

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

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

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

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

fiveHundred

2023/12/10 07:40

> Unity2020.3.48f1 バージョン2020はLTS版含めサポート終了したみたいです。 2021以降を使ってください。 > https://developers.google.com/admob/unity/quick-start?hl=ja 上記のURLの内容は(「外部依存関係を含める」や「アプリ ID を AdMob 設定」なども含め)全て行ったとみていいですか?
CPU

2023/12/10 08:29

>バージョン2020はLTS版含めサポート終了したみたいです。 そうなのですか!知らなかったです。新しくインストールすることになるのですが、2023.2.2f1でよろしいのでしょうか? >上記のURLの内容は(「外部依存関係を含める」や「アプリ ID を AdMob 設定」なども含め)全て行ったとみていいですか? 外部依存関係を含めるの最初の "Google Mobile Ads Unity プラグインは、Unity Play Services Resolver ライブラリとともに配布されます。このライブラリは、Android 固有のライブラリ(AAR や iOS CocoaPods など)へのアクセスを必要とする Unity プラグインで使用されます。Unity プラグインで依存関係を宣言する機能が提供されます。宣言された依存関係は自動的に解決されて Unity プロジェクトにコピーされます。" の部分は何をしていいのか分からなくてできていません。 "プロジェクトにすべての依存関係が含まれるようにするには、次の手順を行います。"の部分はAndroidの場合のものを行い、"Resolution Succeeded"と出るようになっています。 他の部分は完了しています。
guest

回答3

0

投稿2023/12/12 13:24

isimasa

総合スコア295

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

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

CPU

2023/12/13 10:03

回答していただきありがとうございました。Unityのバージョンの問題であったのか分かりませんが、自己解決できましたので報告させていただきます。また、機会があれば回答していただけますと幸いです。
guest

0

UnityではなくAndroid周りとかのエコシステム側でErrorでると顔面真っ青デスヨネ・・・
一回落ち着いてみてみましょう。

UnityのバージョンをUnity2023.2.2f1にすることでエラーメッセージが変わりましたので、そのエラーメッセージを下に記載しました。

恐らくErrorの本体はこれです

A problem occurred evaluating project ':launcher'. > Failed to apply plugin 'com.android.internal.application'. > Cannot parse project property android.enableR8='' of type 'class java.lang.String' as boolean. Expected 'true' or 'false'.

android.enableR8 がPurseできない(そんなもんはねえ!)と言ってます

R8ってなんじゃらほいと思ってググったら難読化Propertyっぽいです

どうやらこれにみんなハマってるらしくてトラブル記事を見てるとgradleTemplate.properties の # android.enableR8=**MINIFY_WITH_R_EIGHT** をCommentアウトして解決してるらしいですね
どうもGoogle謹製のUnitySDK(Firebaseとか)とUnity2022の組み合わせでよく起きてるみたいです
2022でSupportしてないのはenableR8ではなく MINIFY_WITH_R_EIGHT 変数みたいなので

ただコメントアウトすると難読化がキャンセルされるから修正は
android.enableR8=true の方がSecureな気がするなあと思います。 

参考にしたforumを張っておくので最終的にどう直すかはお任せします

投稿2023/12/12 03:10

UnitySoldier

総合スコア204

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

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

CPU

2023/12/12 12:07

回答ありがとうございます。しかしながらまだエラーが出て解決できていませんので、下に行った内容とエラーメッセージを書かせていただきます まず、gradleTemplate.properties の # android.enableR8=**MINIFY_WITH_R_EIGHT** をCommentアウトしてビルドしました。 そのようにすると、またエラーメッセージが変わりましたので下に記します。 エラーメッセージ1 ``` > Configure project :launcher WARNING:The option setting 'android.bundle.enableUncompressedNativeLibs=false' is deprecated. The current default is 'true'. It will be removed in version 8.0 of the Android Gradle plugin. You can add the following to your build.gradle instead: android { packagingOptions { jniLibs { useLegacyPackaging = true } } } > Configure project :unityLibrary Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-31\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-33\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-31\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-33\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only Checking the license for package NDK (Side by side) 23.1.7779620 in C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\licenses Warning: License for package NDK (Side by side) 23.1.7779620 not accepted. ``` エラーメッセージ2 ``` FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':unityLibrary'. > com.android.builder.sdk.LicenceNotAcceptedException: Failed to install the following Android SDK packages as some licences have not been accepted. ndk;23.1.7779620 NDK (Side by side) 23.1.7779620 To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager. All licenses can be accepted using the sdkmanager command line tool: sdkmanager --licenses Or, to transfer the license agreements from one workstation to another, see https://developer.android.com/studio/intro/update.html#download-with-gradle Using Android SDK: C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK * 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 ``` エラーメッセージ3 ``` CommandInvokationFailure: Gradle build failed. C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-7.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "bundleRelease" Environment Variables: USERDOMAIN = DESKTOP-7H0H2MI ProgramFiles = C:\Program Files TMP = C:\Users\81907\AppData\Local\Temp PROCESSOR_ARCHITECTURE = AMD64 PROCESSOR_REVISION = 8c01 OneDriveConsumer = C:\Users\81907\OneDrive OS = Windows_NT ALLUSERSPROFILE = C:\ProgramData PROCESSOR_IDENTIFIER = Intel64 Family 6 Model 140 Stepping 1, GenuineIntel ProgramW6432 = C:\Program Files USERPROFILE = C:\Users\81907 JAVA_HOME = C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK CommonProgramFiles = C:\Program Files\Common Files DriverData = C:\Windows\System32\Drivers\DriverData ComSpec = C:\WINDOWS\system32\cmd.exe PSModulePath = C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules EFC_39540 = 1 USERNAME = 81907 NUMBER_OF_PROCESSORS = 8 TEMP = C:\Users\81907\AppData\Local\Temp Path = C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;c:\Program Files (x86)\Symantec\VIP Access Client\;C:\Users\81907\anaconda3;C:\Users\81907\anaconda3\Library\bin;C:\Users\81907\anaconda3\condabin;C:\Users\81907\anaconda3\Scripts;C:\Program Files\Git\cmd;C:\Users\81907\AppData\Local\Microsoft\WindowsApps;;C:\Users\81907\AppData\Local\Programs\Microsoft VS Code\bin COMPUTERNAME = DESKTOP-7H0H2MI PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC SystemDrive = C: windir = C:\WINDOWS ZES_ENABLE_SYSMAN = 1 PUBLIC = C:\Users\Public CommonProgramFiles(x86) = C:\Program Files (x86)\Common Files APPDATA = C:\Users\81907\AppData\Roaming OneDrive = C:\Users\81907\OneDrive PROCESSOR_LEVEL = 6 CommonProgramW6432 = C:\Program Files\Common Files ProgramFiles(x86) = C:\Program Files (x86) SystemRoot = C:\WINDOWS SESSIONNAME = Console LOGONSERVER = \\DESKTOP-7H0H2MI LOCALAPPDATA = C:\Users\81907\AppData\Local HOMEPATH = \Users\81907 HOMEDRIVE = C: USERDOMAIN_ROAMINGPROFILE = DESKTOP-7H0H2MI ProgramData = C:\ProgramData ORIGINAL_XDG_CURRENT_DESKTOP = undefined stderr[ FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':unityLibrary'. > com.android.builder.sdk.LicenceNotAcceptedException: Failed to install the following Android SDK packages as some licences have not been accepted. ndk;23.1.7779620 NDK (Side by side) 23.1.7779620 To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager. All licenses can be accepted using the sdkmanager command line tool: sdkmanager --licenses Or, to transfer the license agreements from one workstation to another, see https://developer.android.com/studio/intro/update.html#download-with-gradle Using Android SDK: C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK * 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 ] stdout[ > Configure project :launcher WARNING:The option setting 'android.bundle.enableUncompressedNativeLibs=false' is deprecated. The current default is 'true'. It will be removed in version 8.0 of the Android Gradle plugin. You can add the following to your build.gradle instead: android { packagingOptions { jniLibs { useLegacyPackaging = true } } } > Configure project :unityLibrary Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-31\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-33\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-31\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-33\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only Checking the license for package NDK (Side by side) 23.1.7779620 in C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\licenses Warning: License for package NDK (Side by side) 23.1.7779620 not accepted. ] exit code: 1 ``` エラーメッセージ4 ``` Build completed with a result of 'Failed' in 27 seconds (26506 ms) 3 errors ``` また、下のURLのlauncherTemplate.gradleのminifyEnabledもコメントアウトをしてビルドを試してみました。 https://asamagames.com/2022/10/26/unityandroid-enabler8false-is-deprecated/ その結果BuildのFailした秒数以外は全て同じエラーメッセージが出ました。 ここで字数制限が来たため次のコメントに移ります。
CPU

2023/12/12 12:07

最後にandroid.enableR8=trueにしてみました。そうすると、またエラーメッセージが変わりましたので下に記します。 エラーメッセージ1 ``` > Configure project :launcher WARNING:The option setting 'android.bundle.enableUncompressedNativeLibs=false' is deprecated. The current default is 'true'. It will be removed in version 8.0 of the Android Gradle plugin. You can add the following to your build.gradle instead: android { packagingOptions { jniLibs { useLegacyPackaging = true } } } WARNING:The option 'android.enableR8' is deprecated. It was removed in version 7.0 of the Android Gradle plugin. Please remove it from `gradle.properties`. > Configure project :unityLibrary Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-31\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-33\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-31\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-33\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only Checking the license for package NDK (Side by side) 23.1.7779620 in C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\licenses Warning: License for package NDK (Side by side) 23.1.7779620 not accepted. ``` エラーメッセージ2 ``` * Get more help at https://help.gradle.org BUILD FAILED in 3s ``` エラーメッセージ3 ``` CommandInvokationFailure: Gradle build failed. C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-7.6.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "bundleRelease" Environment Variables: USERDOMAIN = DESKTOP-7H0H2MI ProgramFiles = C:\Program Files TMP = C:\Users\81907\AppData\Local\Temp PROCESSOR_ARCHITECTURE = AMD64 PROCESSOR_REVISION = 8c01 OneDriveConsumer = C:\Users\81907\OneDrive OS = Windows_NT ALLUSERSPROFILE = C:\ProgramData PROCESSOR_IDENTIFIER = Intel64 Family 6 Model 140 Stepping 1, GenuineIntel ProgramW6432 = C:\Program Files USERPROFILE = C:\Users\81907 JAVA_HOME = C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK CommonProgramFiles = C:\Program Files\Common Files DriverData = C:\Windows\System32\Drivers\DriverData ComSpec = C:\WINDOWS\system32\cmd.exe PSModulePath = C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules EFC_39540 = 1 USERNAME = 81907 NUMBER_OF_PROCESSORS = 8 TEMP = C:\Users\81907\AppData\Local\Temp Path = C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;c:\Program Files (x86)\Symantec\VIP Access Client\;C:\Users\81907\anaconda3;C:\Users\81907\anaconda3\Library\bin;C:\Users\81907\anaconda3\condabin;C:\Users\81907\anaconda3\Scripts;C:\Program Files\Git\cmd;C:\Users\81907\AppData\Local\Microsoft\WindowsApps;;C:\Users\81907\AppData\Local\Programs\Microsoft VS Code\bin COMPUTERNAME = DESKTOP-7H0H2MI PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC SystemDrive = C: windir = C:\WINDOWS ZES_ENABLE_SYSMAN = 1 PUBLIC = C:\Users\Public CommonProgramFiles(x86) = C:\Program Files (x86)\Common Files APPDATA = C:\Users\81907\AppData\Roaming OneDrive = C:\Users\81907\OneDrive PROCESSOR_LEVEL = 6 CommonProgramW6432 = C:\Program Files\Common Files ProgramFiles(x86) = C:\Program Files (x86) SystemRoot = C:\WINDOWS SESSIONNAME = Console LOGONSERVER = \\DESKTOP-7H0H2MI LOCALAPPDATA = C:\Users\81907\AppData\Local HOMEPATH = \Users\81907 HOMEDRIVE = C: USERDOMAIN_ROAMINGPROFILE = DESKTOP-7H0H2MI ProgramData = C:\ProgramData ORIGINAL_XDG_CURRENT_DESKTOP = undefined stderr[ FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':unityLibrary'. > com.android.builder.sdk.LicenceNotAcceptedException: Failed to install the following Android SDK packages as some licences have not been accepted. ndk;23.1.7779620 NDK (Side by side) 23.1.7779620 To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager. All licenses can be accepted using the sdkmanager command line tool: sdkmanager --licenses Or, to transfer the license agreements from one workstation to another, see https://developer.android.com/studio/intro/update.html#download-with-gradle Using Android SDK: C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK * 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 3s ] stdout[ > Configure project :launcher WARNING:The option setting 'android.bundle.enableUncompressedNativeLibs=false' is deprecated. The current default is 'true'. It will be removed in version 8.0 of the Android Gradle plugin. You can add the following to your build.gradle instead: android { packagingOptions { jniLibs { useLegacyPackaging = true } } } WARNING:The option 'android.enableR8' is deprecated. It was removed in version 7.0 of the Android Gradle plugin. Please remove it from `gradle.properties`. > Configure project :unityLibrary Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-31\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-33\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\build-tools\32.0.0\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-31\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platforms\android-33\package.xml. Probably the SDK is read-only Exception while marshalling C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\package.xml. Probably the SDK is read-only Checking the license for package NDK (Side by side) 23.1.7779620 in C:\Program Files\Unity\Hub\Editor\2023.2.2f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\licenses Warning: License for package NDK (Side by side) 23.1.7779620 not accepted. ] exit code: 1 ``` エラーメッセージ4 ``` Build completed with a result of 'Failed' in 20 seconds (19846 ms) 3 errors ```
CPU

2023/12/13 10:03

回答していただきありがとうございました。Unityのバージョンの問題であったのか分かりませんが、自己解決できましたので報告させていただきます。また、機会があれば回答していただけますと幸いです。
guest

0

自己解決

UnityのバージョンをLTSの2022.3.15f1にしたらエラーメッセージが無くなりました。UnityHubのバージョンアップをしていなかったため、今まで最高のLTSのバージョンが2020年のものだと勘違いしていました。2023年のものはLTSではなかったため、不安定であったと考えられます。正直まだ原因は分かりませんし、また同じエラーが起こるかもしれないです。gradleのバージョンを見たところ全て推奨されているバージョンで動いていました。このような解決方法で申し訳ありません。回答していただいた皆さんありがとうございました。

投稿2023/12/13 09:57

CPU

総合スコア13

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問