I’m at a complete loss here, I’m trying to setup Android Development and have tried 4 different methods even followed the Unreal Engine guide but every time I run the SetupAndroid.bat to install the NDK I get this error
C:\Program Files\Epic Games\UE_4.26\Engine\Extras\Android>SetupAndroid.bat
Android Studio Path: C:\Program Files\Android\Android Studio
Android Studio SDK Path: C:\Users\depre\AppData\Local\Android\Sdk
\Microsoft was unexpected at this time.
If anyone could shed some light onto what’s going on I would appreciate it.
This happens because you have bracket symbols in user paths and whoever wrote this batch script didn’t thought of that.
Can be fixed by editing SetupAndroid.bat and wrapping %USERPATH% in quotes on line 56:
echo Current user path: "%USERPATH%"
Second problem you may encounter is SetupAndroid.bat unable to locate sdkmanager.bat even if it actually exists in <SDKPath>\cmdline-tools\latest\bin\sdkmanager.bat
In this case you need to add this line at the beginning (next line after after @echo off):
setlocal EnableDelayedExpansion
and replace % with ! on lines 67 and 68:
IF EXIST "!SDKMANAGER!" (
echo Using sdkmanager: !SDKMANAGER!
Thanks, I was running this on Windows 11 at the time. I’m not sure if it still has the same issue but I re-installed Windows 10 and it worked just fine. Thanks again for the response, If I come across this issue again I’ll be sure to give this a shot.