- Home /
Getting error Gradle failed to fetch dependencies for Google admob plugin
I am getting this error when integrating Google Admob Plugin when try to force resolve from Android Resolver.
Unity version: 2017.2.0f3 personal. GoogleMobileAds v3.10.0.unitypackage JDK: jdk1.8.0_144
Any help will be appreciated.
Gradle failed to fetch dependencies.
Failed to run 'D:\Temp\PlayServicesResolverGradle\gradlew.bat -b "D:\Temp\PlayServicesResolverGradle\PlayServicesResolver.scripts.download_artifacts.gradle" --no-daemon "-PANDROID_HOME=sdk-2" "-PTARGET_DIR=Game\Assets\Plugins\Android" "-PMAVEN_REPOS=https://maven.google.com" "-PPACKAGES_TO_COPY=com.google.android.gms:play-services-ads:11.6.0"'
stdout:
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_144;
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
stderr:
exit code: 1
UnityEngine.Debug:LogError(Object)
Google.Logger:Log(String, LogLevel)
GooglePlayServices.PlayServicesResolver:Log(String, LogLevel)
GooglePlayServices.<GradleResolution>c__AnonStorey14:<>m__1F(Result)
GooglePlayServices.<GradleResolution>c__AnonStorey15:<>m__28()
GooglePlayServices.PlayServicesResolver:PumpUpdateQueue()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
Thanks
Answer by MaxxRafen · Apr 06, 2018 at 11:12 PM
Hi @pawnakumar113,
The issue is this: JAVA_HOME is set to an invalid directory: C:\Program Files\Java\jdk1.8.0_144;
The solution (at least for windows users) is:
Right click on "my computer" and go to properties.
Go to the Advanced tab
Click on the Environmental Variables... button
Find the JAVA_HOME variable under System Variables
Change the value to wherever this file actually exists for you. (for me it was C:\Program Files\Java\jdk-10)
Restart Unity
I hope that helps!
This solution worked for me still in Jan. 2020. Thank you for your post, I appreciate your clear and concise description so I could fix the problem quickly.
java so poor, it cannot automatically add environment variable...rip java
Answer by Neohun · Sep 27, 2021 at 07:07 PM
Anyone who struggles with this problem, it is caused by a unity bug! I have a solution which works great for me:
Fix Steps:
1- Go to "Edit -> Preferences -> External Tools"
2- Uncheck and re-check "JDK" under android section and you're done!..
This does work but the problem stems from JAVA_HOME. For anyone having this problem create or edit a path for JAVA_HOME in your computers environment variables settings like other guides on this post suggest. This will give you a permanent solution.
Answer by bhautik74jikadra · Feb 23, 2021 at 12:01 PM
Delete all Google AdS files from the Asset Name folder and re-import the Google AdS package.
Or
-Right click on "my computer" and go to properties.
-Go to the Advanced tab
-Click on the Environmental Variables button
-Find the JAVA_HOME variable under System Variables
-Change the value to wherever this file actually exists for you. (for me it was C:\Program Files\Java\jdk-10)
-Restart Unity
Answer by caner_kapisiz · Mar 22 at 09:16 PM
bilgisayar mac bu sorunu çözmek için nasıl bir yöntem deneyebiliriz?
Your answer
Follow this Question
Related Questions
Build for Android crashes on startup after adding AdMob plugin v. 7. 0. 0 in my Unity project 0 Answers
Should I have to set the Unity Org/Project in Services tab, EVERY time i open Unity? 0 Answers
If my game has very few installs, can I still implement real production Ads? 0 Answers
Unity Ads never work on android device! 1 Answer
Detect if a Unity Ad is clicked 0 Answers