title: Gradle failed to fetch dependencies | Resolution failed -in Unity3d
body: <p>This error occurs when I try to build&amp;Run my game with Unity. I've also imported the GooglePlayServices/ads from <a href="https://github.com/googleads/googleads-mobile-unity/releases" rel="nofollow noreferrer">here</a> and also have the latest android sdk and jdk-8u144.</p>
  
  <p>Here is the Error Log:</p>
  
  <pre><code>Gradle failed to fetch dependencies
  
  
  Failed to run 'Temp\PlayServicesResolverGradle\gradlew.bat -b Temp\PlayServicesResolverGradle\PlayServicesResolver.scripts.download_artifacts.    gradle --no-daemon "-PANDROID_HOME=C:/Users/rfkha/AppData/Local/Android/sdk1" "-    PTARGET_DIR=C:\Users\rfkha\Documents\Space Shooter\Assets\Plugins\Android" "-    PMAVEN_REPOS=https://maven.google.com" "-    PPACKAGES_TO_COPY=com.google.android.gms:play-services-ads:11.2.2"'
  stdout:
  
  ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
  
  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)
  GooglePlayServices.PlayServicesResolver:LogDelegate(String, LogLevel)
  Google.JarResolver.PlayServicesSupport:Log(String, LogLevel, Boolean)
  GooglePlayServices.&lt;GradleResolution&gt;c__AnonStorey14:&lt;&gt;m__20(Result)
  GooglePlayServices.&lt;GradleResolution&gt;c__AnonStorey15:&lt;&gt;m__29()
  GooglePlayServices.PlayServicesResolver:PumpUpdateQueue()
  UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
  </code></pre>
  
  <p>2nd Error:</p>
  
  <pre><code>Resolution failed
  
  Failed to fetch the following dependencies:
  com.google.android.gms:play-services-ads:11.2.2
  
  
  UnityEngine.Debug:LogError(Object)
  GooglePlayServices.PlayServicesResolver:LogDelegate(String, LogLevel)
  Google.JarResolver.PlayServicesSupport:Log(String, LogLevel, Boolean)
  GooglePlayServices.ResolverVer1_1:LogMissingDependenciesError(List`1)
  GooglePlayServices.&lt;DoResolutionUnsafe&gt;c__AnonStorey17:&lt;&gt;m__26(List`1)
  GooglePlayServices.&lt;GradleResolution&gt;c__AnonStorey14:&lt;&gt;m__20(Result)
  GooglePlayServices.&lt;GradleResolution&gt;c__AnonStorey15:&lt;&gt;m__29()
  GooglePlayServices.PlayServicesResolver:PumpUpdateQueue()
  UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
  </code></pre>