Hero Background

Next-Gen App & Browser Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud

How to run and debug apps on the emulator?

To run an app on the Android Emulator Online, open your project in Android Studio, pick an AVD from the target device menu, and press Run (Shift+F10). Gradle builds the APK, installs it on the running emulator, and launches it. To debug it, set breakpoints in the gutter and start the app with Debug (Shift+F9). When execution pauses on a breakpoint, the Debug tool window opens with the Debugger and Logcat tabs so you can inspect variables, step through code, and read live logs. You can also drive the same workflow from the terminal with adb and Gradle.

What You Need Before You Start

The emulator ships with Android Studio, so the prerequisites are a current version of Android Studio, the Android SDK, and at least one Android Virtual Device (AVD) image. If the target device menu has no emulators listed, create one in the Device Manager first. Setting up emulators is covered in Install Setup Android Emulators, and tuning an existing AVD (graphics, RAM, cold boot) in Configure Emulator Settings. Once Android Studio and one AVD are ready, you can build and run.

Run an App on the Emulator from Android Studio

The fastest path is the Android Studio build-and-run flow. In one action it compiles the app with Gradle, boots the chosen emulator, installs the APK, and launches it.

  • Open your project in Android Studio.
  • In the toolbar, click the target device menu and choose an AVD such as Pixel 8 API 35. If it is not running, Android Studio cold-boots it for you.
  • Press Shift+F10, choose Run > Run 'app', or click the green Run arrow.
  • Gradle builds the debug variant, signs it with a debug key, installs the APK on the emulator, and launches the app automatically.
  • Interact with the running app in the emulator window using your mouse and keyboard exactly as a user would tap and type.

Build and Deploy from the Command Line

When you already have a built .apk (from CI, a colleague, or a prior build), you can install it on a running emulator without opening Android Studio. Confirm the emulator is connected with adb devices, then install the package. Gradle can also build and deploy the debug variant in a single task.

# List the connected emulators and devices
adb devices

# Install an APK on the running emulator
adb install app.apk

# Reinstall over an existing app, keeping its data
adb install -r app.apk

# Target a specific emulator when more than one is running
adb -s emulator-5554 install app.apk

# Build the debug variant and install it in one Gradle task
./gradlew installDebug

This command-line workflow is what most CI pipelines and automation frameworks use under the hood to put a build on an emulator before running tests against it.

Debug Your App on the Emulator

To debug, start the app with Debug (Shift+F9) instead of Run, or attach the debugger to an already-running process. Android Studio installs a debug build on the emulator and connects the debugger. The main facilities are:

  • Breakpoints: click the gutter to the left of a line, or place the caret on the line and press Control+F8 (Command+F8 on macOS), to pause execution there. Right-click a breakpoint to add a condition, a log message, or to disable it.
  • Debugger tab: when paused, the Debug tool window opens with the Frames pane (the call stack and threads) and the Variables pane, where you can expand objects and inspect their current state.
  • Step controls: use Step Over to run the next line, Step Into to enter a method call, Step Out to finish the current method, and Resume Program to continue to the next breakpoint.
  • Evaluate Expression: enter an ad hoc expression using the variables and methods available in the selected frame to compute a value or add it to the Watches list without editing your code.
  • Logcat tab: read messages from the Log class, system services, and stack traces in real time while the app runs, so you can trace flow without stopping at every line.

View Logs with Logcat (adb logcat)

Inside the IDE, open View > Tool Windows > Logcat to read the emulator's logs filtered by process, tag, and priority. Outside Android Studio, adb logcat streams the same buffer, and a filterspec keeps the output limited to your app instead of the whole system.

# Stream all logs from the emulator
adb logcat

# Clear the log buffer before a fresh run
adb logcat -c

# Show only your tag at Info level and above, silence the rest
adb logcat MyAppTag:I *:S

# Filter the unified log to a process and save it to a file
adb logcat | grep com.example.myapp > app.log

Profile Performance with the Android Studio Profiler

When the app runs but feels slow, leaks memory, or makes too many network calls, open the Profiler from View > Tool Windows > Profiler while the app is running on the emulator. It gives you live, recordable timelines:

  • CPU Profiler: record method traces and system traces to find hot methods, jank, and main-thread work that should run in the background.
  • Memory Profiler: track allocations, capture heap dumps, and force garbage collection to catch leaks and retained objects.
  • Network Profiler: inspect outgoing requests and responses, payload sizes, and timing to spot chatty or oversized calls.
  • Energy Profiler: estimate the battery impact of CPU, network, and location use so you can flag wakelocks and background drains.

Apply Changes and Hot Reload

Rebuilding and redeploying after every small edit is slow. Android Studio's Apply Changes lets you push updates to the app already running on the emulator without a full reinstall, as long as the device runs Android 8.0 (API 26) or higher:

  • Apply Changes and Restart Activity: pushes both code and resource changes and restarts the current activity, so layout and string edits show up immediately.
  • Apply Code Changes: pushes only code changes inside method bodies without restarting the activity, keeping you on the same screen and state.
  • When a full Run is required: structural changes such as adding a method, changing a class signature, or editing the manifest can't be hot-swapped and need a normal Run or Debug.

Test Deep Links, Intents, and Extended Controls

The emulator can reproduce many runtime conditions so you can debug code paths that are hard to trigger by hand. Use adb shell am start to fire intents and deep links, and the emulator's Extended controls panel (the "…" button on the emulator toolbar) to simulate the environment.

# Open a deep link / VIEW intent in your app
adb shell am start -W -a android.intent.action.VIEW \
  -d "myapp://promo/123" com.example.myapp

# Launch a specific activity directly
adb shell am start -n com.example.myapp/.MainActivity

# Send a custom broadcast the app listens for
adb shell am broadcast -a com.example.myapp.ACTION_SYNC
  • Location: set a fixed GPS coordinate or play back a GPX/KML route to test map and geofencing code.
  • Phone and SMS: simulate an incoming call or text message to verify interruption handling.
  • Battery and network: change the charge level, charger state, and cellular signal to exercise low-battery and offline paths.
  • Sensors and snapshots: adjust virtual sensors and save or load device snapshots for a repeatable starting state.

To plug the emulator into Appium, Espresso, or your CI workflow, see Integrate Emulator with Testing Tools. If the emulator refuses to boot, hangs, or throws install errors, Troubleshoot Emulator Errors walks through the fixes.

Emulator vs Real Android Devices

The emulator is fast for the inner loop of writing code and stepping through it, but it is not a perfect stand-in for physical hardware. Cameras, fingerprint and face unlock, real push delivery, true performance and thermals, and OEM skins such as Samsung One UI, Xiaomi MIUI, or OPPO ColorOS can behave differently from the emulated version. Maintaining a shelf of physical Android phones for every version and vendor is expensive, which is where cloud Android devices help. With TestMu AI's Real Device Cloud you can install the same APK on a remote, physical Android handset, interact with it live in your browser, capture Logcat and video, and reproduce the device-only bugs an emulator cannot surface. The iOS counterpart of this workflow is covered in How to Run and Debug Apps on the Simulator?.

Frequently Asked Questions

How do I run an app on the Android emulator?

Open your project in Android Studio, pick an AVD from the target device menu, and press Run (Shift+F10) or click the green Run arrow. Android Studio builds the APK with Gradle, signs it with a debug key, installs it on the running emulator, and launches it. From the terminal you can do the same with adb install app.apk after starting an emulator.

How do I debug an app on the emulator?

Set breakpoints by clicking the gutter or pressing Control+F8, then start the app with Debug (Shift+F9). When execution hits a breakpoint, the Debug tool window opens with the Debugger tab showing the Frames and Variables panes. Use Step Over, Step Into, Step Out, and Resume to move through the code, Evaluate Expression to inspect ad hoc values, and the Logcat tab to read live logs.

How do I install an APK on the emulator from the command line?

Start an emulator, confirm it is connected with adb devices, then run adb install app.apk to install the package. Use adb install -r app.apk to reinstall over an existing app while keeping its data, and adb -s emulator-5554 install app.apk to target a specific emulator instance when more than one is running.

How do I view logs from the Android emulator?

Inside Android Studio open View > Tool Windows > Logcat to read the emulator's logs in real time, filtered by process, tag, and priority. From the terminal, adb logcat streams the same log buffer, and you can narrow it with a filterspec such as adb logcat MyAppTag:I *:S or clear it first with adb logcat -c.

What is Apply Changes in Android Studio?

Apply Changes pushes code and resource changes to the running app on the emulator without a full reinstall, and Apply Code Changes pushes only code changes without restarting the activity. They rely on runtime instrumentation in Android 8.0 (API 26) and higher and give you a faster edit-run loop. Structural changes, such as adding a method or editing the manifest, still need a full Run.

Can the emulator test everything a real Android device can?

No. The emulator is excellent for fast iteration, but real hardware behaviour around cameras, fingerprint and face unlock, push notifications, true performance and thermals, and OEM skins such as Samsung One UI or Xiaomi MIUI can differ from the emulated version. For release-critical validation, run the build on real Android devices, including a real device cloud.

Related Questions

Test Your Website on 3000+ Browsers

Get 100 minutes of automation test minutes FREE!!

Test Now...

KaneAI - Testing Assistant

World’s first AI-Native E2E testing agent.

...

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests