Setup: JDK, Android Studio, SDK & Emulator (AVD)

In this lesson, you’ll set up everything required to build Android apps in Java. We’ll install the JDK and Android Studio, configure the SDK, create an emulator (AVD), and (optionally) enable USB debugging on a real device.

Setup Overview

1. Install JDK

Java compiler/runtime for Android Studio & Gradle.

2. Android Studio

Official IDE + tools (SDK Manager, AVD Manager).

3. SDK Components

Platforms, Build-Tools, Platform-Tools (adb).

4. Emulator

Create & run a Virtual Device (Pixel API 34, etc.).

5. Device (Optional)

Enable USB Debugging + drivers.

Minimum Requirements

ItemRecommended
RAM8 GB (16 GB for smooth emulator experience)
Disk Space10–20 GB free (SDKs, emulators consume space)
CPUEnable Virtualization (Intel VT-x/AMD-V) in BIOS
OSWindows 10/11, macOS, or a modern Linux distro

1) Install JDK (Java Development Kit)

Android Studio includes its own runtime, but having a JDK is useful for Java tools and Gradle compatibility. Install a recent LTS (e.g., JDK 17). After installing, verify on the terminal/cmd:

// Windows (Command Prompt / PowerShell)
java -version

// macOS / Linux
java -version

You should see a version line (e.g., openjdk version "17.x"). Optional (Windows): set JAVA_HOME:

# Windows (PowerShell) – adjust your JDK path
setx JAVA_HOME "C:\Program Files\Java\jdk-17"
setx PATH "%PATH%;%JAVA_HOME%\bin"

2) Install Android Studio

  1. Download and install the latest Android Studio.
  2. Launch it and complete the first-time setup wizard.
  3. Choose the Standard installation (recommended).
Note: Android Studio will install the Android SDK, Platform-Tools (includes adb), and essential components.

3) Configure SDK Components

Open SDK Manager (toolbar icon or File → Settings → Appearance & Behavior → System Settings → Android SDK):

TabWhat to select
SDK Platforms Check the latest stable Android version (e.g., Android 14 (API 34)). You can add older versions (API 21+) if you need to test compatibility.
SDK Tools Ensure these are installed:
  • Android SDK Build-Tools
  • Android SDK Platform-Tools (adb)
  • Android SDK Tools / Command-line Tools
  • Intel x86 Emulator Accelerator (HAXM) (Windows/Intel) or ensure Hyper-V / WHPX (Windows) or Apple Hypervisor (macOS) is available.

4) Create an Emulator (AVD)

  1. Open AVD Manager (toolbar phone icon).
  2. Click Create Virtual Device → choose a phone profile (e.g., Pixel 5).
  3. Select a system image (e.g., Android 14 (API 34)).
  4. Finish. Click the Play button to launch the emulator.
Tip: If emulator is slow, enable CPU virtualization in BIOS and allocate more RAM for the AVD.

5) (Optional) Use a Real Device via USB

  1. On device: go to Settings → About phone → tap Build number 7 times to enable Developer options.
  2. In Developer options, turn on USB debugging.
  3. Connect via USB → accept the fingerprint prompt.
  4. On Windows, install OEM USB driver if device is not recognized.

Check device visibility:

adb devices

Development Flow (Big Picture)

Create/Import Project └─> Write UI (XML) & Logic (Java) └─> Build with Gradle (resolves dependencies) └─> Run on Emulator or USB Device (adb install) └─> Debug with Logcat, Profiler └─> Sign (Debug/Release) & Publish (APK/AAB)

Where are my SDK & Tools?

ThingTypical Location
SDK PathAndroid Studio → Settings → Appearance & Behavior → System Settings → Android SDK (path shown at top)
Platform-Tools<sdk>/platform-tools/ (contains adb)
Build-Tools<sdk>/build-tools/<version>
AVD ImagesWindows: C:\Users\<you>\.android\avd, macOS/Linux: ~/.android/avd

Troubleshooting

Emulator extremely slow / won’t start

  • Enable Virtualization in BIOS/UEFI (Intel VT-x / AMD-V).
  • On Windows (Intel): install HAXM or use Hyper-V/WHPX (don’t mix both).
  • On Windows (AMD): ensure WHPX is enabled; use x86_64 images.
  • Close other hypervisors (VirtualBox/VMware) which can conflict.

“SDK not found / Build-tools missing”

  • Open SDK Manager → install SDK Platform, Build-Tools, Platform-Tools.
  • Check Android Studio Project Structure → SDK Location points to a valid SDK path.

“Gradle sync failed”

  • Check internet connectivity; Gradle needs to download dependencies.
  • If behind a proxy, set proxy in Appearance & Behavior → System Settings → HTTP Proxy.
  • Try File → Invalidate Caches / Restart…
  • Delete the project’s .gradle/ and build/ folders and sync again (last resort).

Device not detected via USB

  • Enable USB debugging and accept fingerprint prompt.
  • Use a data-capable USB cable; try another port.
  • Windows: install OEM USB driver (from your device manufacturer).
  • Run adb kill-server then adb start-server, then adb devices.

“Application ID / Package name” confusion

  • applicationId in Gradle uniquely identifies your app on Play Store/devices.
  • Java package names (code) can differ from applicationId, but keeping them aligned is simpler.
Tip: Keep your emulator images updated (AVD Manager), and periodically update SDK components.