Firebase- Gradle failed to fetch dependencies.

Not sure as to wth is going on but my JAVA_HOME and PATH are in fact set to : C:\Program Files\Unity\Hub\Editor\2019.2.8f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\OpenJDK\Windows and my install path in unity is set to this as well!! Any ideas what the heck is going on.

Gradle failed to fetch dependencies.
Failed to run ‘D:\Unity Apps\Squadron\Temp\PlayServicesResolverGradle\gradlew.bat --no-daemon -b “D:\Unity Apps\Squadron\Temp\PlayServicesResolverGradle\PlayServicesResolver.scripts.download_artifacts.gradle” “-PANDROID_HOME=C:/Program Files/Unity/Hub/Editor/2019.2.8f1/Editor/Data/PlaybackEngines/AndroidPlayer\SDK” “-PTARGET_DIR=D:\Unity Apps\Squadron\Assets\Plugins\Android” “-PMAVEN_REPOS=file:///D:/Unity%20Apps/Squadron/Assets/Firebase/m2repository” “-PPACKAGES_TO_COPY=com.google.firebase:firebase-common:19.1.0;com.google.firebase:firebase-analytics:17.2.0;com.google.firebase:firebase-app-unity:6.6.0;com.google.firebase:firebase-auth:19.0.0;com.google.firebase:firebase-auth-unity:6.6.0;com.google.firebase:firebase-database:19.1.0;com.google.firebase:firebase-database-unity:6.6.0;com.google.firebase:firebase-functions:19.0.1;com.google.firebase:firebase-iid:[20.0.0];com.google.firebase:firebase-functions-unity:6.6.0;com.google.firebase:firebase-messaging:20.0.0;com.google.firebase:firebase-messaging-unity:6.6.0;com.google.firebase:firebase-storage:19.0.1;com.google.firebase:firebase-storage-unity:6.6.0” “-PUSE_JETIFIER=0” “-PDATA_BINDING_VERSION=3.4.0”’
stdout:
ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files\Unity\Hub\Editor\2019.2.8f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\OpenJDK\Windows;
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) (at Z:/tmp/tmp.cfOHeQ7pJN/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/Logger.cs:103)
GooglePlayServices.PlayServicesResolver:Log(String, LogLevel) (at Z:/tmp/tmp.CbcF1w0aJu/third_party/unity/unity_jar_resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:957)
GooglePlayServices.c__AnonStorey1:<>m__2(Result) (at Z:/tmp/tmp.CbcF1w0aJu/third_party/unity/unity_jar_resolver/source/PlayServicesResolver/src/GradleResolver.cs:369)
GooglePlayServices.c__AnonStorey2:<>m__0() (at Z:/tmp/tmp.CbcF1w0aJu/third_party/unity/unity_jar_resolver/source/PlayServicesResolver/src/GradleResolver.cs:468)
Google.RunOnMainThread:ExecuteNext() (at Z:/tmp/tmp.cfOHeQ7pJN/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:377)
Google.RunOnMainThread:m__1() (at Z:/tmp/tmp.cfOHeQ7pJN/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:408)
Google.RunOnMainThread:RunAction(Action) (at Z:/tmp/tmp.cfOHeQ7pJN/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:234)
Google.RunOnMainThread:ExecuteAll() (at Z:/tmp/tmp.cfOHeQ7pJN/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:406)
Google.RunOnMainThread:Run(Action, Boolean) (at Z:/tmp/tmp.cfOHeQ7pJN/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:363)
GooglePlayServices.c__AnonStorey1:<>m__8(Result) (at Z:/tmp/tmp.CbcF1w0aJu/third_party/unity/unity_jar_resolver/source/PlayServicesResolver/src/GradleResolver.cs:468)
GooglePlayServices.ProgressReporter:SignalComplete() (at Z:/tmp/tmp.CbcF1w0aJu/third_party/unity/unity_jar_resolver/source/PlayServicesResolver/src/CommandLineDialog.cs:116)
GooglePlayServices.ProgressReporter:CommandLineToolCompletion(Result) (at Z:/tmp/tmp.CbcF1w0aJu/third_party/unity/unity_jar_resolver/source/PlayServicesResolver/src/CommandLineDialog.cs:107)
GooglePlayServices.c__AnonStorey1:<>m__0() (at Z:/tmp/tmp.CbcF1w0aJu/third_party/unity/unity_jar_resolver/source/PlayServicesResolver/src/CommandLine.cs:137)
Google.RunOnMainThread:ExecuteNext() (at Z:/tmp/tmp.cfOHeQ7pJN/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:377)
Google.RunOnMainThread:m__1() (at Z:/tmp/tmp.cfOHeQ7pJN/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:408)
Google.RunOnMainThread:RunAction(Action) (at Z:/tmp/tmp.cfOHeQ7pJN/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:234)
Google.RunOnMainThread:ExecuteAll() (at Z:/tmp/tmp.cfOHeQ7pJN/third_party/unity/unity_jar_resolver/source/VersionHandlerImpl/src/RunOnMainThread.cs:406)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions() (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:303)

Try This.
Firebase- Gradle failed to fetch dependencies.(JAVA_HOME not set error)

Step 1: install jdk from https://www.oracle.com/java/technologies/oracle-java-archive-downloads.html

click Java SE and click on Java SE 8 (8u202 and earlier)
open the url click on browser ctrl + f and find Java SE Development Kit 8u144 download the jdk version and install**.**
OR
https://www.filepuma.com/download/java_development_kit_64bit_8.0.1440.1-16071/
Download and install
Check successfully install jdk create path [C:\Program Files\Java\jdk1.8.0_144](http://C:\Program Files\Java\jdk1.8.0_144)

Step 2: set jdk path in unity. Edit>Preferences>External Tools> JDK installed with unity(recommended) untick checkbox
paste the path [C:\Program Files\Java\jdk1.8.0_144](http://C:\Program Files\Java\jdk1.8.0_144).

my problem is same
i have tried jdk from oracle but not fixed

have you fixed it