Command fails: ionic emulate --target=gn1 android


#1

Hi,

I am trying to run an android emulation on my Mac OS X 10.9.4 host and it is failing. I cannot figure out why it isn’t working and need some expert help.

Here is some setup information:

$ uname -rsv
Darwin 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun  3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64
$ ant -version
Apache Ant(TM) version 1.9.3 compiled on December 23 2013
$ ionic -version
v1.1.9
$ cordova -version
3.5.0-0.2.6
$ npm -version
1.4.21
$ android list avd
Available Android Virtual Devices:
    Name: galaxy_nexus
  Device: Galaxy Nexus (Google)
    Path: /Users/jlinoff/.android/avd/galaxy_nexus.avd
  Target: Android 4.4.2 (API level 19)
 Tag/ABI: default/armeabi-v7a
    Skin: 720x1280
---------
    Name: gn1
  Device: 4in WVGA (Nexus S) (Generic)
    Path: /Users/jlinoff/.android/avd/gn1.avd
  Target: Android 4.4.2 (API level 19)
 Tag/ABI: default/armeabi-v7a
    Skin: 480x800

Here is the error that I am seeing (ios emulation works):

$ ionic emulate --target=gn1 android
.
.
debug:

BUILD SUCCESSFUL
Total time: 8 seconds
Waiting for emulator...

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:1001:11)
    at Process.ChildProcess._handle.onexit (child_process.js:792:34)
Error: /Users/jlinoff/work/apps/PgBarcodeScanner/platforms/android/cordova/run: Command failed with exit code 8
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

Where gn1 is an android virtual device that I created. I can run the virtual device just fine as follows:

$ emulator-arm -avd gn1 -gpu on

How can I track this down and fix it?

Any insights would be greatly appreciated.

Thanks


#2

I figured out a workaround that got things working for me.

$ find . -name '*apk'   # find the APK file
$ adb install <absoulte-path-to-apk-file>   # install it
$ emulator64-arm -camera-front webcam0 @gn1  # emulate with the APK, using a camera
$ adb uninstall <absolute-path-to-apk-file>  # remove it

I have scripted this to work as an alternative to the emulate command.