DEV Community

HaramChoi
HaramChoi

Posted on

Set Up Android Sdk Command Line Tools without Android Studio

Case01: Set Up for the Android Emulator

  1. Download the Android SDK Command-Line Tools

  2. Install the necessary tools:

    # create a directory for the cli-tools, and move the .zip file into the directory mkdir android_sdk cd android_sdk mv <PATH_TO_YOUR_DOWNLOADED_ZIP_FILE> . # unzip the downloaded file, and put the contents in the new directory 'latest/' unzip commandlinetools-<YOUR_PLATFORM>-8512546_latest.zip mkdir cmdline-tools/latest cd cmdline-tools/latest mv ../* . # The hierarchy of the 'android_sdk/': └- android_sdk/ ├- cmdline-tools/ ├- latest/ ├- bin/ ├- lib/ ├- NOTICE.txt └- source.properties # Install platform and build tools # You can fetch the complete list of available packages via: bin/sdkmanager --list # Install the desired package and tools via: bin/sdkmanager --install "system-images;android-33;google_apis;x86_64" # The above command will download and install the tools in the sdk_root (android_sdk/) 
  3. Download and install the Emulator:

    bin/sdkmanager --install "emulator" 
  4. Create a new avd device:

    bin/avdmanager create avd -n mytestdevice -k "system-images;android-33;google_apis;x86_64" 
  5. Check if the avd device is available:

    # go to the 'emulator/' directory, and run the command cd ../../emulator ./emulator -list-avds # Now you should see your newly created avd device `mytestdevice` 
  6. Run the emulator

    ./emulator -avd mytestdevice 

Case02: Set Up for a real Android Device

  1. Go to the official site and download the SDK Platform-Tools

  2. Unzip the .zip file. You can find the adb binary within the extracted directory.

    cd platform-tools # Show every available Android device ./adb devices 

Top comments (0)