Adding Android SDK

I get an error that shows a box on the screen that says do you want to try again… then it fails and box comes back when i click on the Yes. so I dug in deeper and its error code is 4

UATHelper: Cooking (Android (Multi:ASTC,DXT,ETC2)): ERROR: Command C:\UE_5.6\Engine\Extras\Android\SetupAndroid.bat android-34 35.0.1 3.22.1 27.2.12479018 -noninteractive failed [Exit code 4, working dir = C:\UE_5.6\Engine\Extras\Android]

Packaging Results: Error: Command C:\UE_5.6\Engine\Extras\Android\SetupAndroid.bat android-34 35.0.1 3.22.1 27.2.12479018 -noninteractive failed [Exit code 4, working dir = C:\UE_5.6\Engine\Extras\Android]

But have no clue why, can anyone help?

Tested the Setupandroid.bat with parameters (SetupAndroid.bat android-34 35.0.1 3.22.1 27.2.12479018 -noninteractive) from command line and it ran fine but did really nothing. so is it Turnkey that isn’t working.

or did my installation get fubar’d if so how do I uninstall the Android SDK and reinstall it?

I had a similar issue. I fixed it by following the advanced guide here: Advanced setup and troubleshooting guide for using Android SDK. | Unreal Engine 5.7 Documentation | Epic Developer Community
But the main things for me were the NDK environment variables were not setup and then instead of using the AndroidSetup.bat I manually added the SDK, NDK and JDK file paths in the project settings. After this I re-ran the SDK install from the editor and it finally completed properly.

I then had to do the final bits on this guide in the project settings to complete the setup: Android Quick Start | Unreal Engine 5.7 Documentation | Epic Developer Community

I know this is a bit late to be answering this but I found your post when I had a similar issue so hopefully this helps someone else.

I suspect it was due to my game coming from a slightly older version of UE5 or because my drive letters are a bit messed up so it was struggling to find the paths properly for the required SDK, NDK and JDK folders.