ToolNotFoundException: jar not found.

Hi,

I’m unable to switch my Platform to Android. My console get spammed with “ToolNotFoundException: jar not found.”

  • “Edit->Preferences->External Tools->Use embedded JDK” is checked

  • My JAVA_HOME environment variable is set to the Unity embedded JDK “C:\Program Files\Unity\Hub\Editor\2018.3.4f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\OpenJDK\Windows”

  • PATH environment variable includes %JAVA_HOME%\bin

  • I’m able to run “jar” from command prompt.

I’m now out of ideas.

ToolNotFoundException: jar not found.
GooglePlayServices.ResolverVer1_1.ShouldExplode (System.String aarPath) (at Z:/tmp/tmp.mz1RZCSjez/third_party/unity/unity_jar_resolver/source/PlayServicesResolver/src/ResolverVer1_1.cs:1513)
GooglePlayServices.ResolverVer1_1.LoadAarExplodeCache () (at Z:/tmp/tmp.mz1RZCSjez/third_party/unity/unity_jar_resolver/source/PlayServicesResolver/src/ResolverVer1_1.cs:256)
GooglePlayServices.ResolverVer1_1..ctor () (at Z:/tmp/tmp.mz1RZCSjez/third_party/unity/unity_jar_resolver/source/PlayServicesResolver/src/ResolverVer1_1.cs:220)
GooglePlayServices.PlayServicesResolver..cctor () (at Z:/tmp/tmp.mz1RZCSjez/third_party/unity/unity_jar_resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:624)
Rethrow as TypeInitializationException: The type initializer for 'GooglePlayServices.PlayServicesResolver' threw an exception.
Firebase.Editor.XcodeProjectPatcher..cctor () (at Z:/tmp/tmp.sXL81rhJWV/firebase/app/client/unity/editor/src/XcodeProjectPatcher.cs:61)
Rethrow as TypeInitializationException: The type initializer for 'Firebase.Editor.GenerateXmlFromGoogleServicesJson' threw an exception.
System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
System.Activator.CreateInstance (System.Type type) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
UnityEditor.AssetPostprocessingInternal.GetTextureProcessorsHashString () (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:490)
UnityEditor.AssetPostprocessingInternal:GetTextureProcessorsHashString()

Restarting the computer has fixed the issue. Very weird.

1 Like

it doesn’t helps for me

1 Like

I have the same problem
Did you get it right?

It strange but I just have rebooted and these errors just disappeared

Bumping this, on 2019.1.(5f or 7f). I installed the android packages through Hub, and have all the boxes checked in Preferences->External Tools for java and android. My builds fail with the same Jar Not Found errors.

same… help plz

More info: If i click “Build” and simply save the apk locally i get the same errors in the console but the build completes and writes the APK to disk. If I have my testing phone plugged in (same phone that worked before i reinstalled my operating system) and i try ‘Build and run’ the build process fails almost immediately with the same errors in the console.

Fixed! I had to set the ANDROID_HOME environment variable to the SDK path, in my advanced systems settings on windows. I just pointed it at the unity managed copy of the SDK, which for me was C:\Program Files\Unity\Hub\Editor\2019.1.7f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK

I also logged out and back in again to make sure the environment variable was picked up by already running programs.

Here’s a guide: Set ANDROID_HOME and Path Environment Variables For SDK In Windows

bump

I had the same trouble. What I did was:

  • Download jdk latest version from Oracle
  • Install it
  • In Unity Editor: Menu Edit\Preferences
  • Uncheck “JDK installed with Unity (recommended)”
  • Click on browse
  • Select folder where jdk was installed. in my case C:\Program Files\Java\jdk1.8.0_231 (default installation folder)
  • Ctrl+s (just in case… :slight_smile:
  • Restart editor.

It fixed the bug to me.

I hope it helps you.

1 Like

It happens when you use embedded JDK and delete previous Unity version. JDK that is pointed by all your Unity editors and JAVA_HOME is deleted too. I changed JAVA_HOME to a new path since I had a newer Unity with Open JDK. But it didn’t help, so here is how I fixed it.

Solution:

  1. In Unity open Edit - Preferences - External Tools
  2. Uncheck “Use embedded JDK”, here you will see path to the deleted JDK
  3. Browse "Program Files\Unity\Hub\Editor(your new Unity version)\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\OpenJDK\Windows (for me Unity even changed path automatically to a newer installed version) once I pressed browse)
  4. Check “Use embedded JDK”, now Unity will use correct path to it
  5. Copy a new path and change your JAVA_HOME to it
9 Likes

so weird error

Estava com o mesmo problema, no meu caso era o erro estava no endereço “C:/Program Files/Unity/Hub/Editor/2019.4.12f1/Editor/Data/PlaybackEngines/AndroidPlayer\OpenJDK” pode ver que tem uma contra barra antes do diretorio OpenJDK. Eu retirei ela e coloquei a barra correta.

I had the same issue when trying to download the Advertisements package. It got fixed after I just unchecked and checked again everything in “Android” In Preferences > External Tools

2 Likes