# How to Launch the Android Emulator from the Command Line

## How do I launch the Android emulator from the command line?

I assume that you have built your project and just need to launch it, but you don't have any AVDs created and have to use command line for all the actions. You have to do the following.

1. Create a new virtual device (AVD) for the platform you need. If you have to use command line for creating your AVD, you can call android create avd -n <name> -t <targetID> where targetID is the API level you need. If you can use GUI, just type in android avd and it will launch the manager, where you can do the same. You can read more about AVD management through GUI and through command line.
2. Run the AVD either by using command emulator -avd <name> or through previously launched GUI. Wait until the emulator fully loads, it takes some time. You can read about additional options here.
3. Now you have to install the application to your AVD. Usually during development you just use the same Ant script you used to build the project, just select install target. However, you can install the application manually using command adb install <path-to-your-APK>.
4. Now switch to emulator and launch your application like on any normal device, through the launcher. Or, as an alternative, you can use the following command: adb shell am start -a android.intent.action.MAIN -n <package>/<activity class>. For example: adb shell am start -a android.intent.action.MAIN -n org.sample.helloworld/org.sample.helloworld.HelloWorld. As a commenter suggested, you can also replace org.sample.helloworld.HelloWorld in the line above with just .HelloWorld, and it will work too.

## Android: How to launch emulator from command line?

Open command prompt anywhere and use the following command

• To get the list of available emulator

emulator -list-avds

• To open a emulator

emulator -avd Nexus_5X_API_23

## How to run emulator from command line

I guess you did not specify the correct name of your AVD. You can use emulator -list-avds to see a list of your available AVDs and use their name with emulator -avd {name_of_avd} to run that AVD. For more information check this link

## How to Launch Android Gradle App using command line on emulator and physical device. Not just build

Build Using Command-Line ->

For building our app using the command line you can use -

gradlew assembleDebug (For debug app)

For install apk on the connected device -

gradlew installDebug

For more info, you can check -

https://developer.android.com/studio/build/building-cmdline

## Where to start an Emulator in command line

Here is the Answer for you..

and HERE is the complete reference to create and start emulator in command prompt

more guides are available Google it before asking

## Android Emulator - Command Line Building

Since MacOSX is just a fork of BSD Linux, the emulator can be run in background by appending the ampersand:

emulator -avd NexusSeven &

To ignore all output, the following command will help:

emulator -avd NexusSeven > /dev/null 2>&1 &

## Can not start android emulator from command line

I had the exact same issue and I am using a workaround. Let me explain:

There is a 'bug' in the emulator: it is not able to find the relative path

..\emulator\lib64\qt\lib

Incredibly awesome since this is so simple to fix... whatever.

Just cd to c:\path\to\your\android-sdks\emulator, typically something like

cd c:\Users\userName\android-sdks\emulator

then, in this directory, run any emulator command you want, for instance your command:

emulator.exe -avd Nexus_3_7_API_17_ver_4_2_1

in your teminal this will look like this:

c:\Users\userName\android-sdks\emulator> emulator.exe -avd Nexus_3_7_API_17_ver_4_2_1

and it will work.