After building Android, typing emulator at the command line will cause the recently-built AVD to run in the build’s emulator. This happens seamlessly because the build process adds <ANDROID BASEDIR>/out/host/linux-x86/bin/emulator to the PATH. The build process also sets the ANDROID_PRODUCT_OUT environment variable, which points to the directory containing the disk images that comprise your new AVD.
After restarting the computer, emulator will no longer be in the path, and when you try to run <ANDROID BASEDIR>/out/host/linux-x86/bin/emulator, it produces the an error:
|
1 2 3 4 5 6 7 8 9 |
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 |
To fix this, you can explicitly set ANDROID_PRODUCT_OUT to point to your disk image directory by typing
|
1 2 3 |
$ export ANDROID_PRODUCT_OUT=<ANDROID BASEDIR>/out/target/product/generic/ |
before running the build or Android SDK emulator.
The easier fix for “emulator: ERROR: You did not specify a virtual device name”
If it works for you, you can run build/envsetup.sh and then setpaths, which will set up the environmental variables automatically, fixing the “emulator: ERROR: You did not specify a virtual device name” issue.
In addition to setpaths and lunch, envsetup.sh provides a few other handy commands that make development easier:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment: - croot: Changes directory to the top of the tree. - m: Makes from the top of the tree. - mm: Builds all of the modules in the current directory. - mmm: Builds all of the modules in the supplied directories. - cgrep: Greps on all local C/C++ files. - jgrep: Greps on all local Java files. - resgrep: Greps on all local res/*.xml files. - godir: Go to the directory containing a file. Look at the source to view more functions. The complete list is: addcompletions add_lunch_combo cgrep check_product check_variant choosecombo chooseproduct choosetype choosevariant cproj croot findmakefile gdbclient get_abs_build_var getbugreports get_build_var getprebuilt gettop godir help isviewserverstarted jgrep key_back key_home key_menu lunch _lunch m mm mmm pid printconfig print_lunch_menu resgrep runhat runtest set_java_home setpaths set_sequence_number set_stuff_for_environment settitle smoketest startviewserver stopviewserver systemstack tapas tracedmdump |
If setpaths doesn’t fix the “emulator: ERROR: You did not specify a virtual device name” problem, try manually exporting ANDROID_PRODUCT_OUT.
Incoming search terms:
emulator: error: you did not specify a virtual device name and the system directory could not be found
emulator: ERROR: You did not specify a virtual device name and the system
add_lunch_combo command not found
emulator error you did not specify a virtual device name
android_product_out
neither -p product specified nor android_product_out set
You did not specify a virtual device name and the system directory could not be found
emulator emulator: error: you did not specify a virtual device name and the system directory could not be found
android godir did not find
add_lunch_combo: command not found
Pingback: No emulator after building Android kernel : Android Community - For Application Development