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

実現したいこと

前提

私は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を使用しているので私のエラーには当てはまりませんでした

コメントを投稿

0 コメント