Problems with building for Android and iOS

Since a couple of days, I have troubles to get my Meteor 1.6 app built for Android. I haven’t changed much, but all of a sudden, most of the times I run into an error if I call meteor run android-device.

Sometimes, I get the error resource temporarily unavailable, which seems to be related to insufficient process or file handles.

Sometimes, the error is A problem occurred starting process 'Gradle build daemon'.

This happens at random. Sometimes, the very same code base builds smoothly and deploys successfully to the device.

Any ideas what might be causing this? I haven’t changed anything to my Android setup, nor did I update Meteor to a newer version.

Edit: A system reboot seems to help, but this isn’t a nice solution.

Update: this problem also applies to iOS builds, with the error code EAGAIN:

Here is one example:

%% Failed to install 'phonegap-plugin-push': Error: /Users/waldgeist/Documents/Development/htdocs/outwards/webapp/.meteor/local/cordova-build/platforms/android/cordova/version: Command failed with exit code EAGAIN
    at ChildProcess.whenDone (/Users/waldgeist/.meteor/packages/meteor-tool/.1.6.0.19bnlyx.auvu++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova-lib/node_modules/cordova-common/src/superspawn.js:169:23)
    at emitOne (events.js:115:13)
    at ChildProcess.emit (events.js:210:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
    at onErrorNT (internal/child_process.js:374:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
=> Errors executing Cordova commands:                                              
                                                                                   
   While adding plugin phonegap-plugin-push@1.5.2 to Cordova project:              
   Error:                                                                          
   /Users/waldgeist/Documents/Development/htdocs/outwards/webapp/.meteor/local/cordova-build/platforms/android/cordova/version:
   Command failed with exit code EAGAIN
   at ChildProcess.whenDone
   (/Users/waldgeist/.meteor/packages/meteor-tool/.1.6.0.19bnlyx.auvu++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/cordova-lib/node_modules/cordova-common/src/superspawn.js:169:23)
   at emitOne (events.js:115:13)
   at ChildProcess.emit (events.js:210:7)
   at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
   at onErrorNT (internal/child_process.js:374:16)
   at _combinedTickCallback (internal/process/next_tick.js:138:11)
   at process._tickCallback (internal/process/next_tick.js:180:9)

I remember the EAGAIN failure as not having any Internet connection so the plugin was not being downloaded successfully

Hm, I still get these problems, but I have a working internet connection.

And yes, it happens when the platform tries to download Cordova plugins. Interestingly, different plugins are affected. This is pretty annoying.

Now I realize I don’t know where the plugins are being downloaded from. Maybe a network traceroute to the host can help check