Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

ToolNotFoundException: jar not found.

Discussion in 'Formats & External Tools' started by martin_unity660, Mar 4, 2019.

  1. martin_unity660

    martin_unity660

    Joined:
    Feb 15, 2019
    Posts:
    22
    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.


    Code (CSharp):
    1. ToolNotFoundException: jar not found.
    2. 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)
    3. GooglePlayServices.ResolverVer1_1.LoadAarExplodeCache () (at Z:/tmp/tmp.mz1RZCSjez/third_party/unity/unity_jar_resolver/source/PlayServicesResolver/src/ResolverVer1_1.cs:256)
    4. GooglePlayServices.ResolverVer1_1..ctor () (at Z:/tmp/tmp.mz1RZCSjez/third_party/unity/unity_jar_resolver/source/PlayServicesResolver/src/ResolverVer1_1.cs:220)
    5. GooglePlayServices.PlayServicesResolver..cctor () (at Z:/tmp/tmp.mz1RZCSjez/third_party/unity/unity_jar_resolver/source/PlayServicesResolver/src/PlayServicesResolver.cs:624)
    6. Rethrow as TypeInitializationException: The type initializer for 'GooglePlayServices.PlayServicesResolver' threw an exception.
    7. Firebase.Editor.XcodeProjectPatcher..cctor () (at Z:/tmp/tmp.sXL81rhJWV/firebase/app/client/unity/editor/src/XcodeProjectPatcher.cs:61)
    8. Rethrow as TypeInitializationException: The type initializer for 'Firebase.Editor.GenerateXmlFromGoogleServicesJson' threw an exception.
    9. System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    10. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    11. System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    12. System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    13. System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    14. System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    15. System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    16. System.Activator.CreateInstance (System.Type type) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
    17. UnityEditor.AssetPostprocessingInternal.GetTextureProcessorsHashString () (at C:/buildslave/unity/build/Editor/Mono/AssetPostprocessor.cs:490)
    18. UnityEditor.AssetPostprocessingInternal:GetTextureProcessorsHashString()
     
    Last edited: Mar 4, 2019
  2. martin_unity660

    martin_unity660

    Joined:
    Feb 15, 2019
    Posts:
    22
    Restarting the computer has fixed the issue. Very weird.
     
    Mhietos likes this.
  3. Conferno

    Conferno

    Joined:
    Feb 27, 2014
    Posts:
    49
    it doesn't helps for me
     
    VonTala likes this.
  4. PauloBissonho

    PauloBissonho

    Joined:
    Dec 1, 2018
    Posts:
    4
    I have the same problem
    Did you get it right?
     
  5. Conferno

    Conferno

    Joined:
    Feb 27, 2014
    Posts:
    49
    It strange but I just have rebooted and these errors just disappeared
     
  6. jacknoid

    jacknoid

    Joined:
    Nov 28, 2018
    Posts:
    15
    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.
     
  7. scorp2007

    scorp2007

    Joined:
    Aug 17, 2014
    Posts:
    51
    same... help plz
     
  8. jacknoid

    jacknoid

    Joined:
    Nov 28, 2018
    Posts:
    15
    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.
     
  9. jacknoid

    jacknoid

    Joined:
    Nov 28, 2018
    Posts:
    15
    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: http://www.software-testing-tutoria.../09/set-androidhome-and-path-environment.html
     
  10. Deleted User

    Deleted User

    Guest

  11. HernandoNJ

    HernandoNJ

    Joined:
    May 13, 2018
    Posts:
    75
    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... :)
    - Restart editor.

    It fixed the bug to me.

    I hope it helps you.
     
    lanceroy likes this.
  12. matros

    matros

    Joined:
    Feb 1, 2014
    Posts:
    13
    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
     
  13. ArkTai

    ArkTai

    Joined:
    Dec 27, 2017
    Posts:
    1
    so weird error
     
  14. Cleiton12

    Cleiton12

    Joined:
    Oct 3, 2020
    Posts:
    1
    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.
     
  15. RealRustyGames

    RealRustyGames

    Joined:
    Sep 22, 2022
    Posts:
    1
    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
     
    Deleted User and staxoft like this.