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. Dismiss Notice

Question Error when building Android project "ERROR: JAVA_HOME is not set and no 'java'"

Discussion in 'Editor & General Support' started by Radical_boy, Apr 23, 2021.

  1. Radical_boy

    Radical_boy

    Joined:
    Jan 30, 2021
    Posts:
    8
    (I should mention i am using Firebase database with this project) I transferred this unity project from my laptop to my PC (put the project file from my laptop on a drive and put it on my pc). Now when I try to export it it says: "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH." and
    "CommandInvokationFailure: Failed to update Android SDK package list.
    C:\Program Files\Unity\Hub\Editor\2020.3.5f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin\sdkmanager.bat --list". Other projects on the same version(2020.3.3f1) that I started on the PC work at export but I changed it to 2020.3.5f1 but still nothing. I am using C# so i dont know what that has to do with Java. I am going crazy over this, please help me...
     
    Last edited: Apr 23, 2021
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,722
    Android apps are built primarily using Java. The Java SDK is therefore a requirement to build Android apps.

    You need to install the appropriate Java SDK.

    You can install everything you need from the Unity Hub:
    upload_2021-4-23_11-48-30.png
     
  3. Radical_boy

    Radical_boy

    Joined:
    Jan 30, 2021
    Posts:
    8
    They were installed. Wierdly enough, i opened another ptoject, attached my Registries and Google LLC stuff and now it works. Thx anyways