Sdkmanager path not right

Hello. Hope your Android projects are fun and exciting. I on the other hand cannot get up and running. I followed the docs and installed Studio and the cmdline-tools and my Motorola USB drivers. adbdevice in cmd.exe shows me some number is connected.

Another example of, “it works once then never again”. I first installed Android Studio on my D: drive, which wasn’t recommended… but at least I received SUCCESS, SUCCESS, SUCCESS when running Engine/Extras/Android/SetupAndroid.bat

After SUCCESS I ran into a problem where “…32-bit or 64-bit… ndkroot… failed build”.

So I uninstalled Android Studio and installed to the recommended C:/Project Files.

But now… sdkmanager.bat file cannot be found in “C:\Users\thene\AppData\Local\Android\Sdk\cmdline-tools\latest\bin”… yet it is there.

“Unable to locate sdkmanager.bat”

Anyone know what could be going wrong?

Another problem I faced… - Term 4.5 in the Android SDK T&Cs talks about responsibility and losses. I’ve read many other T&Cs and still find this “threatening” talk that makes me feel I will lose out in a big way.

How many people use Windows 11, or have an Android phone with a Google account? There is also an “unfairness” term, which means companies can’t expect the world from you.

I just wonder… that’s all.

Make sure your ANDROID_HOME environment variable is pointing correctly to your android sdk folder.
Before running SetupAndroid.bat delete the tools folder in your sdk installed directory ( the script will regenerate the folder again)
Inside your sdk folder there is a build tools folder and inside that folder are the version you have installed. Go inside each of them and rename D8.bat to DX.bat, also rename D8.jar to DX.jar inside the lib folder.
good luck

Hello. Do you mean every tools folder? build-tools, cmdline-tools and platform-tools?

No, just inside build-tools, you will see folders named with numbers like 30.0.3 etc, inside each folder you will find D8.bat and lib/D8.jar. rename them to DX.bat and DX.jar.

If I delete the tools folder… how can I go in and change the filenames? :smiley:
So delete the folder, run SetupAndroid.bat, then rename things?
I’ve deleted build-tools, ran SetupAndroid.bat… and build-tools doesn’t show up again.

.bat file is looking for paths in certain places and even some version numbers are incorrect. I wonder where SetupAndroid got its information from?

Yes; my “Users/…/Sdk/ndk” folder is empty.

I never said to delete “build-tools” folder, I said delete the “tools” folder, see the difference ?
“C:\Users<yourUsername>\AppData\Local\Android\Sdk\tools” <--------- tools

Sorry. There is no tools folder and the ndk folder is still empty. I uninstalled 4.27.2 and reinstalled but still having trouble finding sdkmanager.bat

And I renamed .jar and .bat files to DX but still a problem.

What I don’t get is this…

the path is right there

STUDIO_SDK_PATH is set to your ANDROID_HOME environment variable. Your ANDROID_HOME should looks like this, once you install android studio.

Yes. The Environment Variable was correct.

I finally made a copy of SetupAndroid.bat and removed the error code "call “%SDKMANAGER%” " and replaced a direct link to sdkmanager.bat, and now the console downloaded all the appropriate files! :smiley:

Thanks for sticking with me True. I’m chuffed I know a little about .bat files.

I see now the NDKROOT variables

sdksdk

1 Like

Glad you finally fix it :smiley:

Well renaming d8 to dx showed up later. The console threw up an error that said it missed dx.bat… so I see why you said rename the file. But I think this could be a danger. Now gradle is causing problems and compileDebugAidl. I have just installed versions 30 and 31 of the SDK in hopes this will sort it out. I wonder why you’d need to rename files in the first place? I could also hack away and only release a Release build. But you know… I’d like to sort it out.

And anyway… Having my game run on my phone is nice, but I should be learning Unreal. Not messing with my phone!

I solved my problem by changing the "call “%SDKMANAGER%” " to direct link.
thank you so much.

2 Likes


is this correct?

I don’t have UE4 installed this time, so I can’t see the folders. It would be advisable to create a copy of the file sdkmanager.bat - just in case you screw it up.

set SDKMANAGER=%STUDIO_SDK_PATH%/path/to/sdk/sdkmanager.bat

can be changed. “call” uses the SDKMANAGER path to launch the right build tools and extras with the batch file.

set SDKMANAGER = “C:/the/location/of/the.bat”

In Android Studio, in the managing tools options, delete all the build-tools apart from 28.0.3. Everything should be installed automatically then in the command prompt.

The % in %VARIABLE% is a special variable which changes the VARIABLE to a path to remember. So no use adding % in the " "s. This isn’t what we want.

Sorry I edited my post. Hopefully it’s more clearer. I’m not at my computer :slight_smile:

I would remove the %s from within the quotations and add C:/path to “set SDKMANAGER = /path/to.bat” then

call SDKMANAGER “parameter1” “parameter2”

But look at the original batch file for reference. I can’t remember the exact %, “” combination. May mean reinstalling UE4 so you can make a copy and call it “copyof_sdkmanager.bat”

Hi all,

There’s a lot of back-and-forth in this thread, so I just wanted to share my experience.

I was setting up android deployment on a new pc, the SetupAndroid.bat complained about not being able to find SDKMANAGER

I had to edit the .bat from

set SDKMANAGER=%STUDIO_SDK_PATH%\tools\bin\sdkmanager.bat

to

set SDKMANAGER=C:\Users\mywindowsusername\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\sdkmanager.bat

Cheers!