Вы находитесь на странице: 1из 1

8/6/2016

ControltheEmulatorfromtheCommandLine|AndroidStudio

navigation

Android Studio

User Guide

Control the Emulator from the Command Line


Meet
AndroidSDK
Studio
The
Android
includes a mobile device emulator a virtual mobile device that runs on your computer. The

emulator lets you develop and test Android applications without using a physical device.
Workow Basics

This page describes command line features that you can use with the Android Emulator. For information about
Manage Your Project

using the Android Emulator UI, see Using the Android Emulator.
Write Your App

Starting
and Stopping the Emulator
Build and Run Your App
During
development
and testing of your application, you install and run your application in the Android Emulator. You
Run Apps
on the Emulator
can launch the emulator as a standalone application from a command line, or you can run it from within your
Create and Manage Virtual Devices

Android Studio development environment. In either case, you specify the AVD con guration to load and any startup
Control
thewant
Emulator
fromas
thedescribed in this document.
options
you
to use,
Command Line

You can run your application on a single instance of the emulator or, depending on your needs, you can start
Run Apps on a Hardware Device

multiple emulator instances and run your application in more than one emulated device. You can use the emulator
built-in
commands to simulate GSM phone calling or SMS between emulator instances, and you can set up network
Create Run/Debug Congurations
redirection that allows emulators to send data to one another. For more information, see Telephony Emulation, SMS
Emulation,
and Build
Emulator Networking.
Congure Your
ToDebug
startYour
an instance
of the emulator from the command line, navigate to the tools/ folder of the SDK. Enter
App
emulator command like this:
Test Your App

emulatoravd<avd_name>[<options>]

Prole Your App

Publish
Your App
This
initializes
the emulator, loads an AVD con guration and displays the emulator window.
Command
Linecan
Tools
Note: You
run multiple instances of the emulator concurrently, each with its own AVD con guration and

storage area for user data, SD card, and so on.

Release Notes

When you run your app from Android Studio, it installs and launches the app on your connected device or emulator
(launching the emulator, if necessary). You can specify emulator startup options in the Run/Debug dialog, in the
Target tab. When the emulator is running, you can issue console commands as described later in this document.
If you are not working in Android Studio, see Installing Applications on the Emulator for information about how to
install your application.
To stop an emulator instance, just close the emulator window.

Installing Applications on the Emulator


If you don't have access to Android Studio, you can install your application on the emulator using the adb utility.
Before installing the application, you need to build and package it into an .apk as described in Build and Run Your
App. After the application is installed, you can start the emulator from the command line as described previously,
using any startup options necessary. When the emulator is running, you can also connect to the emulator console to
issue commands as needed.
As you update your code, you periodically package and install it on the emulator. The emulator preserves the
application
andcookies
its state
restarts, in afor
user-data
disk
partition. and
To ensure
the application runs
This site uses
todata
storeacross
your preferences
site-speci
c language
displaythat
options.
properly as you update it, you may need to delete the emulator user-data partition. To do so, start the emulator with
OK
https://developer.android.com/studio/run/emulatorcommandline.html

1/1

Вам также может понравиться