SetupAndroid.bat closes immediately after running it

I tried also with UE 4.25 version. I followed the guide step-by-step and it doesn’t work. I red on the internet some issues related to SetupAndroid.bat so I folloed this ( UNREAL ENGINE 4.25.1 PACKAGING FOR ANDROID TUTORIAL UPDATED! - YouTube ) guide. It doesn’t work anyways. I try to start the bat file but it closes immediately.

made a bat fine to read the output and here it is:

Android Studio Path:
Android Studio SDK Path: C:\Users\Win10\AppData\Local\Android\Sdk

after that it crashes :frowning:

edit: I also manually tested the bat file and the problem occurs from this control

IF /I “%ERRORLEVEL%” NEQ “0” (
echo Current user path: %USERPATH%
setx PATH “%USERPATH%;%PLATFORMTOOLS%”
echo Added %PLATFORMTOOLS% to path
)

That SetupAndroid.bat file is trash; the same thing happened to me. I had to manually install the ndk through Android Studio: Configure>SDK Manager>SDK Tools (tab)>Show Package Details (check box)>Scroll down and install NDK version 21.1.6352462. After that, restart your PC and pick up that vid at the 13 min mark.

Same. It does not crash, but it does not load what it needs to for me to type yes in to cmd prompt. Tried above, installing ndk through android studio, still not working.

There is an answer in this thread by @alexandoise that solved my problem (which sounded very similar to yours). The error is caused by parentheses and spaces in your %PATH%. Include usebackq in your script:

FOR /F "tokens=2* usebackq" %%A IN ('REG.exe query "%KEY_NAME%" /v "%VALUE_NAME%"') DO (set USERPATH=%%B)
1 Like

Thank you! This script is indeed trash. All it does it installs the NDK, except that it’s broken.