Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Android build fails with "UnityException: JDK not found"

Discussion in 'Android' started by Krasshirsch, Nov 22, 2019.

  1. Krasshirsch

    Krasshirsch

    Joined:
    Apr 26, 2017
    Posts:
    36
    Setup
    Unity 2019.3.0b12 (Pro License)
    Ubuntu 18.04 (Bionic Beaver)

    OpenJDK
    openjdk version "1.8.0_222"
    OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10)
    OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

    Hello,

    we are currently setting up our Jenkins server to build Android packages with Unity.
    We had to install the OpenJDK, Android SDK and Android NDK package manually because those provided by Unity are not recognized as valid and thus do not work.

    I am unsure whether this topic fits better into the "Android" or "Unity Beta Release" section, but since the the affected elements here involve the Android tool chain I decided to go with this section.

    The error which is blocking the build is
    Unfortunately the default settings (recommended) in "Preferences / External Tools" do not work.
    This is what it looks like after a fresh install with the Android tool chain being installed.

    rec.png

    mod.png

    The editor accepts the manual path in the editor but still throws the above mentioned exception when running a build. The path is routed to the global java installation since the link to the Unity provided OpenJDK under "Data/PlayackEngines/AndroidPlayer/OpenJDK" is refused by the Editor. The same is also valid for the NDK and the SDK.

    man.png

    The JDK is correctly added to the PATH and the JAVA_HOME variable is set as well.

    java.png

    While we haven't tried all version, this behavior is also present using Unity 2019.3.0b(8/9/10/11).
    I am unsure where to look next.
    Any help is greatly appreciated.

    Alexander
     
    Last edited: Nov 22, 2019
  2. SelfishCoder

    SelfishCoder

    Joined:
    Nov 20, 2017
    Posts:
    8
    I have the same issue on Ubuntu 19.10 and Unity 2019.3.0b12 (Personal Licence).
     
  3. Krasshirsch

    Krasshirsch

    Joined:
    Apr 26, 2017
    Posts:
    36
    Last edited: Nov 23, 2019
  4. SelfishCoder

    SelfishCoder

    Joined:
    Nov 20, 2017
    Posts:
    8
  5. Krasshirsch

    Krasshirsch

    Joined:
    Apr 26, 2017
    Posts:
    36
  6. Krasshirsch

    Krasshirsch

    Joined:
    Apr 26, 2017
    Posts:
    36
    @PsychoPhysicist Thanks for the link, it actually contains workarounds which worked in my case.
    It is, however, sad and obvious from the issue report that the android build tool installation for linux, which includes broken permissions, missing folders, invalid paths and ignored editor settings has never seen a single QA test.
     
    Last edited: Nov 24, 2019
    russisunni likes this.
  7. MADiFold

    MADiFold

    Joined:
    Aug 10, 2018
    Posts:
    10
    Weird thing is, I have this issue, but only after installing Easy Mobile Pro into a project....
     
    unity_FVa1zTYpze8TEw likes this.
  8. SelfishCoder

    SelfishCoder

    Joined:
    Nov 20, 2017
    Posts:
    8
    @warpedsenses All of the issues have been resolved by Unity at UnityHub V2.3.0.
     
  9. NoPants_

    NoPants_

    Joined:
    Apr 23, 2014
    Posts:
    27
    I have easy mobile as well, and even with UnityHub V2.3.0 I'm still getting the same error with Easy Mobile Pro..
     
  10. Wichael

    Wichael

    Joined:
    Apr 7, 2018
    Posts:
    5
    I get this error constantly and have to go into external tools, untick use JDK from hub and then try and remove the url that's there. Then tick use JDK from hub again.

    I have to do this multiple times a day...
     
    sreenaths likes this.
  11. jamiewhitephd

    jamiewhitephd

    Joined:
    Jun 8, 2012
    Posts:
    129
    Regarding Easy Mobile, I can also confirm this is a problem for me.
     
  12. Kay_dee007

    Kay_dee007

    Joined:
    May 13, 2018
    Posts:
    4
    this is what worked for me maybe it'll work for you guys . so in my case i messed up the path during the installation of both the HUB ant the unity versions themselves and at the time i only have version 2019.3.3f1 installed with the sdk, ndk, and jdk so before trying to update to newer versions like 2019.3.8f1 and 2019.3.10f1 i fixed the path issues but the jdk wont downlod into the newer versions even from the hub so i copied the jdk from the older verisons into the jdk folder of the newer versions and that fixed it for me
     
  13. aspw1992

    aspw1992

    Joined:
    Sep 11, 2020
    Posts:
    3
    im getting tired with this engine many strange issue make me frustated
     
    JasonDaze likes this.
  14. tataygames

    tataygames

    Joined:
    Aug 4, 2016
    Posts:
    51
    Unity developers have no idea how hard for a simple person to install and make a simple build in unity, this new unity is very confusing, i download it maybe 8 times consume 6 hours, trial and error, it will not work if you dont google or youtube it. this devs making software they dont test if its working. I installed the module for hours expecting I can finaly f*** build in android. yet another bug again wth I consume 2 freakin days just to make this unity work!!!!!

    In my mac unity 2019.4 crashes even at start shutting down my mac mini multiple times!
    Its like unity devs are selling for example a car when the drive press the start it wont work you need a mechanic first lol,
    pls improve Unity its way better before. normal student or professional will not understand this kind of things bugging just for the first install.
     
  15. victormanuelfrancodev

    victormanuelfrancodev

    Joined:
    Apr 7, 2020
    Posts:
    1
    tataygames, how did you build your project? I have the same problem,.. :( did you change the jdk?
     
    Cuicui_Studios likes this.
  16. errorsevendev

    errorsevendev

    Joined:
    Sep 29, 2016
    Posts:
    7
    this really is bullshit. I dont want all your stupid F***ing extra features. I just want to make 1 change to my analytics code and rebuild my app. Think I can do this? Tried 3 different versions of unity now for this 1 app and countless hours messing around with stuff.
    JDK not installed? JDK not found. F*** off it is. I installed it myself. Unity Hub also installed OpenJDK but still the editor just wont detect it.
    Guys just make a product that works. This is ridiculous
     
    Job_MTalha likes this.
  17. Simianosaurus

    Simianosaurus

    Joined:
    Feb 14, 2013
    Posts:
    14
    I was having this issue.
    Turns out my virus scanner (Avast) was silently blocking the install of OpenJDK.

    If I look at the modules in the Hub, I can see that OpenJDK is ticked, but it does not say installed.
    This gives an indication that something failedI.
    I really wish the Hub would shout at the point it fails to install a module though rather than letting it silently fail and keeping the info hidden away, then people might be able to figure out it these issues earlier.

    So my solution was:
    * Disabled the virus scanner
    * Open Unity Hub
    * Go to Installs
    * Click the 3 dots
    * Select Add Modules
    * Expand Android Build Support.
    * Untick and Retick OpenJDK
    * Hope it now installs (it did for me)
     
  18. AAK_Lebanon

    AAK_Lebanon

    Joined:
    May 30, 2015
    Posts:
    72
    So my solution was:
    * Disabled the virus scanner
    * Open Unity Hub
    * Go to Installs
    * Click the 3 dots
    * Select Add Modules
    * Expand Android Build Support.
    * Untick and Retick OpenJDK
    * Hope it now installs (it did for me)[/QUOTE]

    Actually, I can't Untick and Retick OpenJDK, do u have any alternative solution?

    UPDATE: never mind, I have found the solution, just edit this file (make selected=false for the specified module) : C:\Program Files\Unity\Hub\Editor\2020.2.3f1/modules.json
     
    Last edited: Feb 9, 2021
    Candy-Bomber likes this.
  19. tataygames

    tataygames

    Joined:
    Aug 4, 2016
    Posts:
    51
    Hi, what I did is I uninstall everything, and install unity hub, then on unity hub, you can install the version of unity you like I select unity 2019.4.16 which is stable. the only bug is when you click the sprite on the sprite renderer in the inspector it does not locate you to the source image.


    When you open unity hub, click the tab install, and you can install the version of unity you like.
    Pls see attached file.

    And if your using mac, on unity hub on the projects tab. theres a 3 dot there click it then, click advance project settings.
    then in put this word: -force-metal

    This link will show you how to build successfully on android.
    https://forum.unity.com/threads/solved-2019-3-0a4-incompatible-ndk.688108/#post-7101892
     

    Attached Files:

    Last edited: May 4, 2021 at 12:28 PM
unityunity