How to fix "JAVA_HOME environment references a directory" in unity3d

JediMan4ik picture JediMan4ik · Jun 23, 2019 · Viewed 15.9k times · Source

I have a problem showed on this screenshot: https://imgur.com/a/VGHrpVV

The problem has appeared when I imported GoogleMobileAds package to insert AdMob ads to my project. I tried to create 2 local variables "JAVA_HOME" and "PATH" in environment variables using this guide https://null-code.ru/solution/157-reshenie-exception-jar-not-found-windows.html , but it doesn't help me.

Answer

Evorlor picture Evorlor · Aug 5, 2019

It is a Unity bug. To fix:

Edit->Preferences->External Tools
Uncheck Android SDK Tools Installed with Unity (recommended)
Press Browse -> It might update the filepath
Recheck Android SDK Tools Installed with Unity (recommended)

Then:

Assets->Play Services Resolver->Android Resolver->Resolve

This has been tested and works with Unity 2019.1, 2019.2, 2019.3, and 2019.4 LTS.