This guide will help you download, configure, and manage Android SDKs, AVDs (Android Virtual Devices), and emulator settings. Follow the steps below to set up everything on your system.
-
Go to the Official Android Developer Site:
- Visit the Android SDK Download Page.
-
Download Command Line Tools (CLI):
- Under "Command line tools only," select the appropriate version for your operating system (Windows, macOS, or Linux).
-
Extract the ZIP File:
- Windows: Right-click the downloaded
.zipfile and choose "Extract All" to a preferred directory (e.g.,C:\AndroidSDK). - macOS: Double-click the
.zipfile, and it will be extracted to a folder.
Important: Make a note of the extracted directory path (e.g.,
C:\AndroidSDKor~/Android/sdk). - Windows: Right-click the downloaded
After unzipping the SDK:
-
Open a Command Prompt (Windows) or Terminal (macOS).
-
Navigate to the directory where you extracted the SDK.
Example for Windows:
cd C:\AndroidSDK\cmdline-tools\bin
Example for macOS:
cd ~/Android/sdk/cmdline-tools/bin
-
Run the following command to accept licenses and download the latest platform tools:
sdkmanager "platform-tools" "platforms;android-34"
- Open "Control Panel" and go to "System" > "Advanced System Settings."
- Click on "Environment Variables."
- Under "System Variables," click "New."
- Variable Name:
ANDROID_HOME - Variable Value: Path to your extracted SDK folder (e.g.,
C:\AndroidSDK).
- Variable Name:
- Edit the
Pathvariable (under "System Variables") and add the following:C:\AndroidSDK\platform-tools
- Open the
.bash_profileor.zshrcfile in your home directory:nano ~/.zshrc - Add the following lines:
export ANDROID_HOME=~/Android/sdk export PATH=$PATH:$ANDROID_HOME/platform-tools
- Save the file and apply changes:
source ~/.zshrc
- Ensure
ANDROID_HOMEis correctly set to your extracted SDK directory.
Why this is important: Setting these paths allows your system to recognize and use the Android SDK.
Run these commands in your terminal or command prompt:
sdkmanager "build-tools;34.0.0"
sdkmanager "platforms;android-34"These commands install the necessary tools and platform for Android 34.
Make sure your platform-tools directory is included in your system's PATH variable.
Example: On Windows, it will be under the SDK folder: C:\Users\YourUsername\AppData\Local\Android\Sdk\platform-tools.
Run the following command to download the system image for Android 34:
sdkmanager "system-images;android-34;google_apis;x86_64"avdmanager create avd --name "MyAVD" --package "system-images;android-34;google_apis;x86_64"- Replace
MyAVDwith a name you choose for your emulator. - This creates an emulator with Google APIs for Android 34.
To see all available AVDs on your system:
emulator -list-avdsemulator -avd MyAVD -netdelay none -netspeed full -gpu on -memory 4096 -cores 4 -no-snapshot-load -feature KeyboardSupport-gpu on: Enables GPU acceleration.-memory 4096: Allocates 4GB of memory to the emulator.-cores 4: Uses 4 CPU cores for the emulator.-feature KeyboardSupport: Enables physical keyboard support.
If an emulator freezes or needs to be stopped:
adb -s emulator-5554 emu kill- Replace
emulator-5554with your emulator’s ID (found in the list from the previous step).
sdkmanager --updatesdkmanager "emulator"Sometimes you may need to restart the ADB server:
adb kill-serveradb start-serverTo copy files from the AVD to your local system:
Example 1: Pull files to C:\AVDFiles:
adb pull /sdcard/Download/ C:\AVDFilesExample 2: Pull files to D:\avd\Avdx:
adb pull /sdcard/Download/ D:\avd\AvdxTo send files from your computer to the AVD:
Example 1: Push a file to the AVD’s Download folder:
adb push C:\AVDFiles\myfile.txt /sdcard/Download/Example 2: Push an image:
adb push C:\Users\Moham\Downloads\Bg.JPG /sdcard/Download/To create a new directory inside the AVD:
adb shell mkdir /sdcard/DownloadTo remove specific SDK components:
sdkmanager --uninstall "build-tools;34.0.0"
sdkmanager --uninstall "platforms;android-34"
sdkmanager --uninstall "system-images;android-34;google_play;x86_64"sdkmanager --uninstall "build-tools;34.0.0" "platforms;android-34" "system-images;android-34;google_play;x86_64"Congratulations on setting up your Android development environment! With everything installed and configured, you’re ready to build and run your Android projects.
Remember, I believe in you—you’ve got this! 😊