DEV Community

HaramChoi
HaramChoi

Posted on

6 1

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
    
Retry later

Top comments (0)

Sentry growth stunted Image

If you are wasting time trying to track down the cause of a crash, it’s time for a better solution. Get your crash rates to zero (or close to zero as possible) with less time and effort.

Try Sentry for more visibility into crashes, better workflow tools, and customizable alerts and reporting.

Switch Tools