Search Unity

  1. 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

Java 9 (JDK 9) support by Unity Android

Discussion in 'Android' started by Yury-Habets, Oct 9, 2017.

  1. weiping-toh

    weiping-toh

    Joined:
    Sep 8, 2015
    Posts:
    58
    For Mac users, even if the jdk that is set to used is the openjdk8 included in unity, when executing, the java environment gets reset to the system default java environment. So if you have any other java virtual machine environment installed, your android sdk will probably fail to run.

    A quick workaround is to go the /Library/Java/JavaVirtualMachines/ folder and go to the respective virtual machines that has a version higher that 1.8 and rename the Info.plist files to get the system to not recognize the virtual machines when running android builds and then restoring it.
     
  2. weiping-toh

    weiping-toh

    Joined:
    Sep 8, 2015
    Posts:
    58
    Oh and I just found a bug? with the sdkmanager packaged by Unity. Apparently on my Mac, after doing a diff with the sdkmanager script provided by Android Studio, the sdk library module name is different.

    Unity : "-Dcom.android.sdkmanager.toolsdir"
    Android Studio : "-Dcom.android.sdklib.toolsdir"
     
  3. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,094
    @weiping-toh would you mind submitting bug reports on both the issues? Thanks!
     
  4. Keegan_Pillay

    Keegan_Pillay

    Joined:
    Apr 14, 2020
    Posts:
    1
    Pls can someone help me.I'm trying to add the module open jdk in unity but it's not working, it shows that it's being downloaded but when I click on add module after it finishes downloading it shows that the module open jdk is not ticked. Does anyone have a solution?
     
  5. JustAnotherDude

    JustAnotherDude

    Joined:
    Oct 28, 2013
    Posts:
    225
    That doesn't seem right?

     
  6. Grinch_GEO

    Grinch_GEO

    Joined:
    Apr 19, 2014
    Posts:
    92
    at the end of the path "\" needs to be changed to "/" has same problem :) just uncheck and set by hand :) thisis for OPENJDK and SDK :)
     
    Rajmahal, Kaweri, cuokumura and 5 others like this.
  7. excalet007

    excalet007

    Joined:
    Jul 28, 2016
    Posts:
    1
    you saved someone's day. thank you. bless your happiness
     
  8. AYHossGames

    AYHossGames

    Joined:
    May 4, 2020
    Posts:
    4
    logged into the forum for the first time just to say you saved my dam life! thanks!
     
  9. rastleks

    rastleks

    Joined:
    Jul 17, 2014
    Posts:
    18
    In Unity 2019.4 LTS with Mac OS 10.15.5 Open JDK doesn't install properly. After installing Unity 2019 LTS installed with all modules (NDK, OpenJDK, SDK) I can't build with error "Unable to list target platforms" - "Error:Invalid command android".

    Only solution is to install JDK 8 via home-brew. All other solutions doesn't work for me.
     
    nikomikulicic likes this.
  10. nikomikulicic

    nikomikulicic

    Joined:
    Dec 3, 2012
    Posts:
    5
    I also have Unity 2019.4 LTS with Mac OS 10.15.2. and was getting, among other stuff: CommandInvokationFailure: Failed to update Android SDK package list.

    @rastleks solution ☝️ worked for me with manually installing JDK.

    In terminal:
    Code (JavaScript):
    1. brew tap adoptopenjdk/openjdk
    2. brew cask install adoptopenjdk8
    In unity Preferences -> External Tools, uncheck JDK Installed with Unity and set custom path:
    (mine was: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home)
     
  11. crealom

    crealom

    Joined:
    Jun 5, 2020
    Posts:
    2
    Yes this saved my ass. Bug with unity
     
unityunity