Unable to get VR working for Quest 2 due to JAVA_HOME issue (UE 5.2)

Hi,

I’ve researched this for a while now and can’t figure it out. This is for a VR app using the Quest.

I have UE 5.2 installed. I have tried to follow the docs re: installing Android Studio and setting up the sdk, ndk and java.

I’m using Android Studio Giraffe | 2022.3.1 Patch 1.
The command tools are installed. I have Android API 29, as well as 34 installed in Android Studio.

In Project Settings in the Android SDK it’s set as:

I have JAVA_HOME in the environment variables set to: C:\Program Files\Java\jdk-18.0.1.1

image

When I run the game on the quest, the output logs at the end are:

I can’t quite work out why the log at the end always has the error that
JAVA_HOME is set to an invalid directory that ends in jre when I have it set to the jdk in the environment variables.

At some point in the setup I ran the SetupAndroid.bat file from within Engine/Extras/Android and not sure if that has permanently set the JAVA_HOME to the path that ends with jre and that’s why even though I have JAVA_HOME set to the jdk in the enviro variables unreal doesn’t seem to recognise it.

Thanks

For anyone with the same issue, I got this working eventually (at least at the moment). I’m using the latest version of Android Studio. I set the sdk and ndk as in the pictures above and set JAVA_HOME to the jdk within the Android Studio folder which is C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08 and then set the jdk in the player settings to the same file location and finally in Android Studio itself under project structure the jdk is found in the gradle settings and this remains set as jbr-17.

Also, and I stand to be corrected on this - but the SetupAndroid file in Engines/Extras/Android doesn’t do anything magical it just tries to set up the sdk, ndk, jdk, java_home locations automatically, but you can just do it manually.