Skip to content

Android build fails with UnityException: JDK not found on Windows #17

@camnewnham

Description

@camnewnham

Hi, thanks for making this action public. It's very helpful.

After using the action kuler90/setup-unity@v1 with Android on a windows-latest (windows-2022) image on github actions I get the following in the Unity build log (and the build fails):

DisplayProgressbar: Checking prerequisites
Android PostProcess task "Checking prerequisites" took 4.386 ms
DisplayProgressbar: Detect Java Development Kit (JDK)
UnityException: JDK not found
Java Development Kit (JDK) directory is not set or invalid. Please, fix it in Edit / Unity -> Preferences -> External Tools
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[], Boolean)
UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[])
UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTargetGroup, BuildTarget, Int32, BuildOptions, String[])
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions)

The setup-unity log looks normal:

94.[69](https://github.com/Fologram/xr.unity/actions/runs/5664664631/job/15348281824#step:4:70)% of Unity editor "2022.3.4f1" was downloaded 
97.83% of Unity editor "2022.3.4f1" was downloaded 
Unity Editor "2022.3.4f1" successfully downloaded.
Installing Unity Editor "2022.3.4f1"Installation done
"C:/Program Files/Unity Hub/Unity Hub.exe" -- --headless editors --installed

2022.3.4f1 , installed at C:\Program Files\Unity\Hub\Editor\2022.3.4f1\Editor\Unity.exe

"C:/Program Files/Unity Hub/Unity Hub.exe" -- --headless install-modules --version 2022.3.4f1 --module android --childModules

Adding module android-sdk-platform-tools as dependency of android-sdk-ndk-tools.

Adding module android-sdk-build-tools as dependency of android-sdk-ndk-tools.

Adding module android-sdk-platforms as dependency of android-sdk-ndk-tools.

Adding module android-ndk as dependency of android-sdk-ndk-tools.

Adding module android-sdk-platform-tools as dependency of android-sdk-ndk-tools.

Adding module android-sdk-build-tools as dependency of android-sdk-ndk-tools.

Adding module android-sdk-platforms as dependency of android-sdk-ndk-tools.

Adding module android-ndk as dependency of android-sdk-ndk-tools.

Modules installed successfully.

Some discussions here that mention this was an issue (on ubuntu however...) in an older hub version when installing headless: game-ci/unity-builder#489

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions