Installing the Android SDK on a headless server doesn’t seem to be very well documented. I recently needed to do this to get the SDK installed on a TeamCity build agent to automate Android builds and tests.
Below are some simple instructions to help you along the way. I’m using a Mac, so you may need to use slightly different commands if you’re using Linux.