Has anyone solved building Android apk for oculus on 5-5.0.1? 4.5 still works

I spent several days following the official tutorial, watching videos, changing vars in the setup script, uninstalling all apas android studio several versions and Unreal 5 and then just direct inputted the paths into package settings in the sdk fields for 5.0.1. I cant get past it saying NDKROOT not found even though it truly is in my environment variables.

So I decided lets try it in 4.5, i fresh installed 4.5 and its package settings already had my 5 settings so I did nothing to setup, ran build and BAM apk built and tested on device perfectly.

I was reading the logs for 5 and find that 5 looks to be trying to find Android on its Turnkey server, looked that up and it seems to be a new feature with a bunch more settings to setup on google server. I would like to not have to do that if I can turn it off.

Anyway, quick read, 4.5 same settings for SDK NDK and jre paths work perfectly, 5-5.0.1 do not

Windows 10
Same exact SDK/NDK/JRE text field settings for 5.0.1 and 4.27.2

While I cant get it to agree that Android studio is installed, I can walk though the two alert dialogs it shows and then get it to start building something but no files are written to the builds location for 5.0.1
The main error is

ERROR: NDKROOT is not specified; cannot use Android toolchain

it most definitely is in my Environment Vars

the > for full exception trace .txt file is no different for info

Maybe there is a proper version mixture of sdk/ndk/jre and android studio i need. I doubt that though, it would give me different usable errors like incomparable version or just feature failure errors that I can pick though, bu in this case it complains about a missing var.

And then the Turnkey logs read like its actually pointing its lookups to something hard coded in a settings file. I did try importing the settings and even changing the .ini file but those had no change

5.0.1

...

Message dialog closed, result: Ok, title: Turnkey, text: Unable to find Android Studio installer. Please download and install Android Studio 3.5.3 from https://developer.android.com/studio/archive before continuing.
Make sure to use the Run Android Studio and complete the first-time setup!
Choose all default options unless you know what you are doing.
UATHelper: Packaging (Android (ASTC)): ERROR: Android Studio is not installed correctly, after attempted installation.
UATHelper: Packaging (Android (ASTC)): ERROR: Android SDK directory is not set correctly, after attempted installation.
UATHelper: Packaging (Android (ASTC)): Android: (Status=Invalid, Installed=r21e, AutoSDK=, MinAllowed=r21a, MaxAllowed=r23a, Flags="InstalledSdk_ValidVersionExists, Platform_InvalidHostPrerequisites", Error="Android Studio is not installed correctly, after attempted installation.|Android SDK directory is not set correctly, after attempted installation.")
UATHelper: Packaging (Android (ASTC)): Scanning for envvar changes...
UATHelper: Packaging (Android (ASTC)): ... done! 
UATHelper: Packaging (Android (ASTC)): Cleaning Temp Paths...
PackagingResults: Error: Android Studio is not installed correctly, after attempted installation.
PackagingResults: Error: Android SDK directory is not set correctly, after attempted installation.
UATHelper: Packaging (Android (ASTC)): BUILD SUCCESSFUL
UATHelper: Packaging (Android (ASTC)): Setting up ProjectParams for E:\Vrrrrrrr unreal 5\Vrrrrpro\Vrrrrpro.uproject
UATHelper: Packaging (Android (ASTC)): Vrrrrpro.uproject requires a temporary target.cs to be generated (OpenXR plugin is enabled)
UATHelper: Packaging (Android (ASTC)): ********** BUILD COMMAND STARTED **********
UATHelper: Packaging (Android (ASTC)): Running: E:\UNreal 7777\UE_5.0\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.exe Vrrrrpro Android Development -Project="E:\Vrrrrrrr unreal 5\Vrrrrpro\Vrrrrpro.uproject"  "E:\Vrrrrrrr unreal 5\Vrrrrpro\Vrrrrpro.uproject" -NoUBTMakefiles  -remoteini="E:\Vrrrrrrr unreal 5\Vrrrrpro" -skipdeploy -Manifest="E:\Vrrrrrrr unreal 5\Vrrrrpro\Intermediate\Build\Manifest.xml" -NoHotReload -log="C:\Users\BRS-VR\AppData\Roaming\Unreal Engine\AutomationTool\Logs\E+UNreal+7777+UE_5.0\UBT-Vrrrrpro-Android-Development.txt"

...

UATHelper: Packaging (Android (ASTC)): Took 13.014608899999999s to run UnrealPak.exe, ExitCode=0
UATHelper: Packaging (Android (ASTC)): Copying NonUFSFiles to staging directory: E:\Vrrrrrrr unreal 5\Vrrrrpro\Saved\StagedBuilds\Android_ASTC
UATHelper: Packaging (Android (ASTC)): Copying DebugFiles to staging directory: E:\Vrrrrrrr unreal 5\Vrrrrpro\Saved\StagedBuilds\Android_ASTC
UATHelper: Packaging (Android (ASTC)): ********** STAGE COMMAND COMPLETED **********
UATHelper: Packaging (Android (ASTC)): ********** PACKAGE COMMAND STARTED **********
UATHelper: Packaging (Android (ASTC)): ERROR: NDKROOT is not specified; cannot use Android toolchain.
UATHelper: Packaging (Android (ASTC)):        (see C:\Users\BRS-VR\AppData\Roaming\Unreal Engine\AutomationTool\Logs\E+UNreal+7777+UE_5.0\Log.txt for full exception trace)
PackagingResults: Error: NDKROOT is not specified; cannot use Android toolchain.
UATHelper: Packaging (Android (ASTC)): AutomationTool executed for 0h 1m 50s
UATHelper: Packaging (Android (ASTC)): AutomationTool exiting with ExitCode=1 (Error_Unknown)
UATHelper: Packaging (Android (ASTC)): Updating environment variables set by a Turnkey sub-process
UATHelper: Packaging (Android (ASTC)): The system cannot find the path specified.
UATHelper: Packaging (Android (ASTC)): The system cannot find the path specified.

I’ve had very little luck getting my Android Development Environment stood up when I don’t follow these steps: Setting Up Android SDK and NDK for Unreal | Unreal Engine 4.27 Documentation

Make sure the version of Android Studio is “4.0”.

1 Like

FYI the steps to setting up Android for 4.27 works for 5.0. Turnkey is a solution to manage SDK and platform setup, but you don’t have to use it: Automating Platform and SDK Management with Unreal Turnkey | Unreal Engine Documentation.

I believe you. But I need to ask why the same settings for Manually Targeting SDK Paths that work in 4.27 dont work in 5.0.1. I am effectively following the bottom section of the webpage you directed me to.
Checked Android Studio its 4.2.2

The recommended version in the documentation is 4.0, not “4.0 or later”, I had to install that precise version to make it work, maybe something has changed in more recent versions

This is the way

1 Like

I struggled with your exact problems. I eventually figured it out and made a video about it.

Also here is a cross-reference to another post where I detailed the some of the steps