I'm on Mac, working on Android development from the terminal. I have successfully created the HelloWorld project and now I'm trying to run it from the command line in the Android emulator. Which command runs the emulator for my HelloWorld project?
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.
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.
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.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.install
target. However, you can install the application manually using command adb install <path-to-your-APK>
.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.