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.
- 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 inandroid 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. - 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. - 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 commandadb install <path-to-your-APK>
. - 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 replaceorg.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.
Related Topics
How to Get Imsi Number in Android Using Command Line
Android Emulator Is Start But Window Show Blank Screen
React Native | Failed to Install the App. Please Accept All Necessary Sdk Licenses Using Sdk Manager
How to Set Up Android Studio to Work Completely Offline
How to Format Credit Card Expiry Date in Mm/Yy When Entered by User
How to Remove Android Auto-Suggest Underlining in Edittext
How to Set Value for Each Item Button Increase and Decrease Click and Set That Value in Text View
Android - Transform Classes With Dex for Debug
How to Painlessly Change My App Title Text Color
How to Make User Login from Only One Device At a Time
How to Set Align (Right or Left) of Text in Textview, Programmatically
React Native: Java_Home Is Not Set and No 'Java' Command Could Be Found in Your Path
Why Does My Button Not Showing in the Layout
Method to Refresh Fragment Content When Data Changed ( Like Recall Oncreateview)
How to Set Spinner Default by Its Value Instead of Position
Cart Item Count Increment/Decrement & Add to Cart
You Need to Use a Theme.Appcompat Theme (Or Descendant) With This Activity