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?
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
.
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With