40

Using the Cordova CLI, I set up an app and build it:

cordova create hi com.example.hi Hi 
cd hi
cordova platform add android
cordova build android

I run Genymotion and start a device named "api9". I run the Android Debug Bridge adb devices and it shows as

192.168.8.101:5555

I try to launch the app with cordova emulate android but I get:

Error: An error occurred while emulating/deploying the android project. ...spawn ENOENT

However, launching the Android Virtual Device manager and starting an emulated device; the cordova emulate android works and adb devices lists;

192.168.8.101:5555
emulator-5554

What should I do to make Cordova emulate through Genymotion devices?

Dawson Loudon
  • 5,989
  • 2
  • 27
  • 31
numediaweb
  • 13,837
  • 11
  • 59
  • 100

2 Answers2

97

It seems that adb sees genymotion virtual device as a real device and not as an emulated one, try cordova run android instead of cordova emulate android.

DaAwesomeP
  • 575
  • 5
  • 17
Nextneed
  • 1,069
  • 8
  • 5
  • 1
    You made my day :) who would taught of that! – numediaweb Dec 12 '13 at 16:43
  • 1
    that's logical... in fact virtualbox based emulations acts as a real device. – netalex Dec 24 '13 at 09:14
  • At last a snappier way to emulate. Android SDK, with Nexus 7, is painfully sluggish on Mac OS X Yosemite, Imac 2008 12Gb RAM. Genymotion allows to test for more "real" top sellers devices, and a Galaxy S3 emulation is very reactive (using their librairies, not Android SDK - See Genymotion settings). Using the latest version of Genymotion as of 2015-02-01. – Christian Bonato Feb 01 '15 at 20:47
2

When the device list is empty, which is not covered in this case, then you need to connect adb manually to the genymotion device.

Therefore you have it run in the same JAVA SDK environment so don't use the inbuilt one in Genymotion.

Then start up your device. On screen should appear some genymotion icon. Click it and you will see the IP.

Use then in the console the command "adb connect 198.123.123.123" (use your own IP of course).

After that your device list is updated.

Finally use "cordova run android" and it will install your app to the virtual device.

Same applies also for ionic framework: "ionic run android". Caution: without any device found it will fallback to emulator...

  • 'On screen should appear some genymotion icon' Do you mean on screen of the virtual device screen I have no such icon just my normal looking device. – landed Jul 16 '15 at 16:11
  • if there is no icon you can look into the settings of the virtual device and look for network – Harald Doderer Jul 17 '15 at 18:21
  • Have run cordova run android and the genymotion device - then checked the settings went into network and see just wifi ,bluetooth etc....no icon and cant understand why this would be there tbh but thanks for your help.. – landed Jul 20 '15 at 08:59