How to install/downgrade Android SDK via terminal

1. Go to the android developer com  to find the link https://developer.android.com/studio/index.html
mkdir android-sdk
cd android-sdk
on macos: curl -O https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
brew install wget
wget https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip
on linux: wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
unzip sdk-tools-*.zip

2. Go to the 'tools/bin' and run the
./sdkmanager --list
./sdkmanager "platforms;android-25" "tools" "build-tools;25.0.3" "platform-tools"
./sdkmanager --update

 
How to downgrade the Android SDK Tools

In case if you need to downgrade the sdkmanager and use the 'android' you can do the following

SDK Tools Release Notes: https://developer.android.com/studio/releases/sdk-tools.html
SDK Platform Tools Release Notes: https://developer.android.com/studio/releases/platforms.html

To download a manual version of SDK Tools, fill in the following url with a version from the above:
https://dl-ssl.google.com/android/repository/tools_r<version>-windows.zip
https://dl-ssl.google.com/android/repository/tools_r<version>-macosx.zip

  1. Find your Android SDK folder
  2. Locate the "tools" subfolder and rename it to "tools1" (just to keep a backup copy of the original tools folder)
  3. Likewise, rename platform-tools to platform-tools1
  4. Download from google repository the SDK Tool version you want to downgrade to (for instance: http://dl-ssl.google.com/android/repository/tools_r22.6.2-macosx.zip) and unpack it.
  5. The ZIP file you downloaded contains a tools folder that has to be moved to your Android SDK folder.
  6. Likewise, download the platform tools (for instance: http://dl-ssl.google.com/android/repository/platform-tools_r19.0.1-macosx.zip), and extract it in your SDK folder.

For me downgrading to https://dl-ssl.google.com/android/repository/tools_r25.2.5-macosx.zip worked just fine. Once you download an older version the tools, just rename the tools directory at your Android SDK install and replace with the downloaded version.

I didn't need to downgrade Platform Tools, but if you need to, here are those links as well:
https://dl-ssl.google.com/android/repository/platform-tools_r<version>-windows.zip
https://dl-ssl.google.com/android/repository/platform-tools_r<version>-macosx.zip