Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova android emulator stopped working

Tags:

I'm building an app for Android using Cordova. The android emulator was working fine but I wasn't using it because I installed the Ripple emulator. I continued on building my app, but somewhere the emulator got corrupted.

When I execute the following:

cordova create test cordova platform add android cordova build cordova emulate 

Results in the following error:

    Error: An error occurred while emulating/deploying the android project.     events.js:72             throw er; // Unhandled 'error' event           ^     Error: spawn ENOENT         at errnoException (child_process.js:980:11)         at Process.ChildProcess._handle.onexit (child_process.js:771:34)     ] 

I have Cordova 3.2 installed and the Android 4.3 API aswell as 4.4. I tried to reinstall Cordova with

npm uninstall cordova 

And reinstall it again, but it is still producing the same error. I also reinstalled the Android SDK. This is the log when I run run.bat --emulator:

[ 'adb devices', null, 'List of devices attached \r\n\r\n', '' ] exec: android list avds [ 'android list avds', null, 'Available Android Virtual Devices:\n Name: AVD_for_Nexus_S\n Path: C:\\ Users\\Evers\\.android\\avd\\AVD_for_Nexus_S.avd\n Target: Android 4.4 (API lev el 19)\n ABI: armeabi-v7a\n Skin: 480x800\n', '' ] exec: android list avds [ 'android list avds', null, 'Available Android Virtual Devices:\n Name: AVD_for_Nexus_S\n Path: C:\\ Users\\Evers\\.android\\avd\\AVD_for_Nexus_S.avd\n Target: Android 4.4 (API lev el 19)\n ABI: armeabi-v7a\n Skin: 480x800\n', '' ] WARNING : no emulator specified, defaulting to AVD_for_Nexus_S Waiting for emulator... exec: adb devices events.js:72 throw er; // Unhandled 'error' event

Any clues?

like image 910
Evers Avatar asked Dec 02 '13 16:12

Evers


People also ask

Does Cordova support Android 12?

We have integrated the Android 12 SplashScreen API including the compatibility library into the core of the Cordova-Android platform to provide support for Android API 22+.

How do I disable proxy on emulator?

With the emulator open, click More , and then click Settings and Proxy. From here, you can define your own HTTP proxy settings. The -http-proxy option forces the emulator to use the specified HTTP/HTTPS proxy for all outgoing TCP connections.


2 Answers

Just re run after starting emulator manually.

Create Emulator

  1. type android in cmd and hit enter, a GUI will come.
  2. Under tools section click “manage AVDs” and follow the further instruction to create a new AVD.

Start Emulator

  1. emulator.exe -avd *avdname* in cmd (wait for few minutes for full start up)
  2. now re run cordova. it will work.
like image 80
Pradyumna Swain Avatar answered Oct 01 '22 05:10

Pradyumna Swain


I Have recieved the same error myself, there may be 3 issues :

the emulator uses the apk file generated in the platforms/android/bin folder. sometimes this is missing so make sure to:

  1. cd platforms/android
  2. ant clean
  3. ant debug

Which will create the missing apk file if missing.

The second issue may have come with adding it to the emulator, which must be run prior:

How to install an apk on the emulator in Android Studio?

There is also the option to delete and create the android virtual machine using:

AVD at http://developer.android.com/tools/devices/index.html

hope this helps, let me know. There is very little documentation about this error.

like image 41
Ben O Avatar answered Oct 01 '22 07:10

Ben O