Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Cordova/Phonegap to emulate on Genymotion virtual device

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?

like image 589
numediaweb Avatar asked Dec 12 '13 12:12

numediaweb


2 Answers

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.

like image 114
Nextneed Avatar answered Oct 30 '22 08:10

Nextneed


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...

like image 32
Harald Doderer Avatar answered Oct 30 '22 10:10

Harald Doderer