昨日まで動いていましたが、突然にForce resolveができなく途方に暮れていました。その時の解決方法をメモ書きで
問題の内容: Gradleが依存関係を取得できず、Java Runtimeが見つからないというエラーが発生しました。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
Running Gradle... /Users/aaaaaaa/Temp/PlayServicesResolverGradle/gradlew --no-daemon -b <span class="hljs-string">"/Users/aaaaaaa/Temp/PlayServicesResolverGradle/PlayServicesResolver.scripts.download_artifacts.gradle"</span> <span class="hljs-string">"-PANDROID_HOME=/Applications/Unity/Hub/Editor/2021.3.16f1/PlaybackEngines/AndroidPlayer/SDK"</span> <span class="hljs-string">"-PTARGET_DIR=/Users/aaaaaaa/Assets/Plugins/Android"</span> <span class="hljs-string">"-PMAVEN_REPOS=https://maven.google.com/"</span> <span class="hljs-string">"-PPACKAGES_TO_COPY=com.google.android.gms:play-services-ads:22.1.0;com.google.android.ump:user-messaging-platform:2.0.0"</span> <span class="hljs-string">"-PUSE_JETIFIER=1"</span> <span class="hljs-string">"-PDATA_BINDING_VERSION=4.0.1"</span> Executing command: /Users/aaaaaaa/Temp/PlayServicesResolverGradle/gradlew --no-daemon -b <span class="hljs-string">"/Users/aaaaaaa/Temp/PlayServicesResolverGradle/PlayServicesResolver.scripts.download_artifacts.gradle"</span> <span class="hljs-string">"-PANDROID_HOME=/Applications/Unity/Hub/Editor/2021.3.16f1/PlaybackEngines/AndroidPlayer/SDK"</span> <span class="hljs-string">"-PTARGET_DIR=/Users/aaaaaaa/Assets/Plugins/Android"</span> <span class="hljs-string">"-PMAVEN_REPOS=https://maven.google.com/"</span> <span class="hljs-string">"-PPACKAGES_TO_COPY=com.google.android.gms:play-services-ads:22.1.0;com.google.android.ump:user-messaging-platform:2.0.0"</span> <span class="hljs-string">"-PUSE_JETIFIER=1"</span> <span class="hljs-string">"-PDATA_BINDING_VERSION=4.0.1"</span> Reporting analytics data: /androidresolver/resolve/gradle/failed/fetch?unityVersion=<span class="hljs-number">2021.3</span>.<span class="hljs-number">16</span>f1&unityPlatform=OSXEditor&installSource=unitypackage&version=<span class="hljs-number">1.2</span>.<span class="hljs-number">176</span>&scope= <span class="hljs-symbol">'Android</span> Resolver: Gradle Resolve: Tool Extraction Failed' ERROR: Gradle failed to fetch dependencies. Failed to run '/Users/aaaaaaa/Temp/PlayServicesResolverGradle/gradlew --no-daemon -b <span class="hljs-string">"/Users/aaaaaaa/Temp/PlayServicesResolverGradle/PlayServicesResolver.scripts.download_artifacts.gradle"</span> <span class="hljs-string">"-PANDROID_HOME=/Applications/Unity/Hub/Editor/2021.3.16f1/PlaybackEngines/AndroidPlayer/SDK"</span> <span class="hljs-string">"-PTARGET_DIR=/Users/aaaaaaa/Assets/Plugins/Android"</span> <span class="hljs-string">"-PMAVEN_REPOS=https://maven.google.com/"</span> <span class="hljs-string">"-PPACKAGES_TO_COPY=com.google.android.gms:play-services-ads:22.1.0;com.google.android.ump:user-messaging-platform:2.0.0"</span> <span class="hljs-string">"-PUSE_JETIFIER=1"</span> <span class="hljs-string">"-PDATA_BINDING_VERSION=4.0.1"</span>' stdout: stderr: The operation couldn���t be completed. Unable to locate a Java Runtime. Please visit http:<span class="hljs-comment">//www.java.com for information on installing Java.</span> exit code: <span class="hljs-number">1</span> |
解決手順:
-
Unityの外部ツール設定を確認: UnityのPreferencesから「External Tools > Android > JDK Installed with Unity」の設定を確認します。
-
設定変更: 設定画面で「JDK Installed with Unity」のチェックを外し、再度チェックします。
-
Force resolveを実行: Assets->External Dependency Manager->Android Resolver->Force resolveを実行する
-
正常終了: エラーが解消され、正常にGradleの処理が完了することを確認します。
![画像](https://assets.st-note.com/img/1702366188605-Sxo5ItuuWO.png)
参考リンク:
コメントを残す