Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Fastest way to setup android-cli-tool
- =====================================================================================================================
- Install Android SDK & Create AVD (Android 13 / API 33)
- Simple one-time setup script to install Android command-line tools, SDK, and create an Android Virtual Device (AVD) using OpenJDK 17.
- # 1️⃣ Update system and install essential packages
- sudo apt update && sudo apt upgrade -y
- sudo apt install -y openjdk-17-jdk wget unzip git curl nano
- # 2️⃣ Download the latest Android command-line tools
- wget https://dl.google.com/android/repository/commandlinetools-linux-13114758_latest.zip
- # 3️⃣ Create SDK directory structure
- mkdir -p ~/Android/cmdline-tools/
- mv cmdline-tools/ latest
- # 4️⃣ Extract the downloaded command-line tools to the SDK path
- unzip commandlinetools-linux-13114758_latest.zip -d ~/Android/cmdline-tools
- # 5️⃣ Go to the extracted directory
- cd ~/Android/cmdline-tools
- # 6️⃣ Rename folder to 'latest' (required by Android SDK layout)
- mv cmdline-tools/ latest
- # Full Path
- ~/Android/cmdline-tools/latest/bin
- # 7️⃣ Edit your shell profile to add environment variables
- nano ~/.profile
- # 8️⃣ Add SDK environment variable (inside ~/.profile)
- export ANDROID_SDK_ROOT=$HOME/Android
- # 9️⃣ Add Android tools to PATH (also inside ~/.profile)
- export PATH=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/platform-tools:$PATH
- # 🔁 Apply environment changes
- source ~/.bashrc
- # 🔍 Navigate to the SDK tools directory
- cd $ANDROID_SDK_ROOT/cmdline-tools/latest/bin
- # ⚙️ Install essential Android components (platform-tools, emulator, SDKs)
- sdkmanager "platform-tools" "emulator" "platforms;android-33" "system-images;android-33;google_apis;x86_64"
- # ✅ Accept all SDK licenses
- sdkmanager --licenses
- # 📱 Create an Android Virtual Device (AVD)
- avdmanager create avd -n myAVD -k "system-images;android-33;google_apis;x86_64" --device "pixel"
- 15 $ANDROID_SDK_ROOT/emulator/emulator -avd myAVD # Wih KVM (faster)
- 16 $ANDROID_SDK_ROOT/emulator/emulator -avd myAVD -no-accel # No KVM (normal/slow)
- 17 $ANDROID_SDK_ROOT/emulator/emulator -avd myAVD -gpu swiftshader_indirect # Software based graphics (fastest)
- 18 $ANDROID_SDK_ROOT/emulator/emulator -avd myAVD -memory 8192 -qemu -smp cores=2 # add more RAM and cores
- =====================================================================================================================
- #FEDORA
- sudo dnf install @virtualization;sudo dnf builddep qemu
- #UBUNTU
- sudo apt install qemu-kvm libvirt-daemon-system virtinst virt-manager;sudo apt update && sudo apt build-dep qemu
- # List installed devices
- emulator -list-avds
- =====================================================================================================================
- 🧩 Step-by-step setup for Android TV Emulator
- # 1️⃣ Install Android TV system images
- sdkmanager "system-images;android-33;android-tv;google_apis;x86_64"
- # 2️⃣ Create an Android TV AVD (emulator)
- avdmanager create avd -n AndroidTV \
- -k "system-images;android-33;android-tv;google_apis;x86_64" \
- --device "tv_1080p"
- # 3️⃣ List available AVDs
- emulator -list-avds
- # 4️⃣ Run the Android TV emulator
- emulator -avd AndroidTV
- =====================================================================================================================
- ⚙️ Step-by-Step: Create a Wear OS Emulator
- # 1️⃣ Install Wear OS system image
- sdkmanager "system-images;android-33;wearos;google_apis;x86_64"
- # 2️⃣ List available Wear OS device definitions
- avdmanager list device | grep -i wear
- # 3️⃣ Create a new Wear OS virtual device
- avdmanager create avd -n WearOS \
- -k "system-images;android-33;wearos;google_apis;x86_64" \
- --device "wearos_small_round"
- # 4️⃣ List available AVDs to confirm creation
- emulator -list-avds
- # 5️⃣ Launch the Wear OS emulator
- emulator -avd WearOS
Advertisement
Add Comment
Please, Sign In to add comment