Friday, October 9, 2009

Create Android Virtual Device (AVD) in command line

In the article How to create Android Virtual Device (AVD) in Eclipse and Create an SD Card to existing AVD, I described how to create AVD in Eclipse and how to add SD Card to existing AVD. In this article, I describe how to create AVD, with SD Card, in command line (Terminal of Ubuntu Linux).

Environment:
OS: Ubuntu Linux 9.04
Android SDK 1.6 r1

- Before create AVD, you have to check the available system image targets in your system.

Start Terminal, switch to the tools folder of the installed Android SDK, it's ~/android-sdk-linux_x86-1.6_r1/tools in my own setup. Type the command:
$./android list targets



- Now you can create a new AVD, eg. a new AVD base on Android 1.6 (ID = 2), with 1000M SD Card.

Type the command:
$./android create avd -n my_android1.6_for_scripting -t 2 -c 1000M

You will be asked: Do you wish to create a custom hardware profile
Press Enter to answer NO.

After a while, the new AVD will be created.

- Start Emulator with the new AVD
$./emulator -avd my_android1.6_for_scripting

No comments: