How do I launch the Android emulator from the command line

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

http://developer.android.com/resources/tutorials/hello-world.html http://developer.android.com/resources/tutorials/hello-world.html

I already have the Android tools and platform-tools in my PATH.

  Edit:   

How do I tell the emulator to run my HelloWorld project from the command line? I ve already built the project with ant.

Answers

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.

    http://developer.android.com/tools/devices/managing-avds-cmdline.html http://developer.android.com/tools/devices/managing-avds-cmdline.html https://developer.android.com/studio/run/emulator-commandline.html#startup-options https://developer.android.com/studio/run/emulator-commandline.html#startup-options
    • 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>.
    • 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.

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/4974568/how-do-i-launch-the-android-emulator-from-the-command-line

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils