问题
I am trying to get the Android emulator up and running on my 64-bit Ubuntu 12.04 distro. First, I had to install ia32-libs to get around some earlier issues that I had encountered on previous (failed) attempts.
I then downloaded and installed the 64-bit linux distro. I navigated to the android
application (SDK Manager) on the command line, and ran it. I downloaded Android Tools and the latest flavor of the Android OS.
I would now like to run emulator
, but when I do, I get the following error:
myUser@myMachine:~/android-sdk/21.1/android-sdk-linux/tools$ ./emulator
emulator: ERROR: You did not specify a virtual device name, and the system
directory could not be found.
If you are an Android SDK user, please use '@<name>' or '-avd <name>'
to start a given virtual device (see -help-avd for details).
Otherwise, follow the instructions in -help-disk-images to start the emulator
When I run ./emulator -help-disk-images
I get output that includes the following:
kernel-qemu the emulator-specific Linux kernel image
ramdisk.img the ramdisk image used to boot the system
system.img the *initial* system image
userdata.img the *initial* data partition image
It will also use the following writable image files:
userdata-qemu.img the persistent data partition image
system-qemu.img an *optional* persistent system image
cache.img an *optional* cache partition image
sdcard.img an *optional* SD Card partition image
snapshots.img an *optional* state snapshots image
If you're neither using the SDK or the Android build system, you
can still run the emulator by explicitely providing the paths to
*all* required disk images through a combination of the following
options: -sysdir, -datadir, -kernel, -ramdisk, -system, -data, -cache
-sdcard and -snapstorage.
This is very confusing. I've seen YouTube examples of people using the emulator with nothing more than ./emulator -datadir=/some/path
.
So I ask:
- What's the difference between running the emulator via the SDK, the "Android build system" (???), and via the terminal like what I'm attempting here?
- Why is it possible in some cases to run the emulator via
./emulator -datadir=/some/path
, but the output in this 2nd window seems to require 4 - 8 command line arguments? - At what point do I fire up the AVD Manager and set up my machine?
Thanks in advance!
回答1:
You must create an AVD configuration before launching the emulator:
android create avd -n <name> -t <targetID> [-<option> <value>] ...
http://developer.android.com/tools/devices/managing-avds-cmdline.html#AVDCmdLine
then you're ready to launch it
emulator -avd <avd_name> [<options>]
http://developer.android.com/tools/devices/emulator.html#starting
来源:https://stackoverflow.com/questions/15992631/how-to-configure-android-emulator-once-sdk-is-installed