meteor run android- spawn ENOENT and gradle errors from Cordova

Viewed 725

I am attempting to run a Meteor project on an Android device and/or emulator. When I run either meteor run --verbose android or meteor run --verbose android-device, I get errors related to Cordova not being able to find certain gradle files. Here's some output from my console:

sarah@sarah-ThinkPad-X220:~/simple-todos$ meteor run --verbose android
Getting installed version for platform android in Cordova project
Checking Cordova requirements for platform Android
[[[[[ ~/simple-todos ]]]]]                    

=> Started proxy.                             
=> Started MongoDB.                           
Local package version is up-to-date: autopublish@1.0.4
<... removed some other "Local package" messages here ...>
Preparing Cordova project from app bundle     
Copying resources for mobile apps             
Writing new config.xml                        
Preparing Cordova project for platform Android
Running Cordova app for platform Android with options --emulator
ANDROID_HOME=/home/sarah/Android/Sdk/        |
JAVA_HOME=/usr/lib/jvm/default-java
=> Started your app.                          

=> App running at: http://localhost:3000/     
WARNING : no emulator specified, defaulting to nexus4
Waiting for emulator...oid Emulator          |
emulator: UpdateChecker: skipped version check
BOOT COMPLETEpp on Android Emulator          -                                               
cp: no such file or directory: /home/sarah/Android/Sdk/tools/templates/gradle/wrapper/gradlew

chmod: File not found: /home/sarah/simple-todos/.meteor/local/cordova-build/platforms/android/gradle/wrapper/gradle-wrapper.properties

sed: no such file or directory: /home/sarah/simple-todos/.meteor/local/cordova-build/platforms/android/gradle/wrapper/gradle-wrapper.properties

Running: /home/sarah/simple-todos/.meteor/local/cordova-build/platforms/android/gradlew cdvBuildDebug -b /home/sarah/simple-todos/.meteor/local/cordova-build/platforms/android/build.gradle -PcdvBuildArch=x86 -Dorg.gradle.daemon=true

events.js:72app on Android Emulator          \
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:1011:11)
    at Process.ChildProcess._handle.onexit (child_process.js:802:34)
=> Errors executing Cordova commands:         

   While running Cordova app for platform Android with options --emulator:
   Error: Command failed:                     
   /home/sarah/simple-todos/.meteor/local/cordova-build/platforms/android/cordova/run --emulator

   at ChildProcess.exitCallback (/tools/utils/processes.js:137:23)
   at ChildProcess.emit (events.js:98:17)
   at Process.ChildProcess._handle.onexit (child_process.js:820:12)

ExitWithCode:1

Indeed, the files and directories it is trying to access are not there. $ANDROID_HOME/tools/template/gradle/wrapper does not have a directory gradlew

sarah@sarah-ThinkPad-X220:~/Android/Sdk/tools/templates/gradle/wrapper$ ls
gradle

Likewise, there are no files at all in my ~/simple-todos/.meteor/local/cordova-build/platforms/android/gradle/wrapper directory, so there is no gradle-wrapper.properties.

I'm also quite uncertain about the meaning of the spawn ENOENT error.

How can I fix this?

EDIT: I wanted to test that gradle worked at all on my machine, so I made an app in Android Studio and ran it on my phone-- worked fine. My Meteor project still doesn't run on Android, but I think this tells me that gradle is working (somewhere) on my computer.

EDIT: I searched for a gradlew directory on my computer and the only ones I found were in an android-studio, not in my $ANDROID_HOME(~\Android/Sdk). Not sure what to do with this info, but it seems relevant.

EDIT It occurred to me that the output of gradle -v might be useful:

$ gradle -v

------------------------------------------------------------
Gradle 2.5
------------------------------------------------------------

Build time:   2015-08-31 14:26:53 UTC
Build number: none
Revision:     UNKNOWN

Groovy:       2.4.3
Ant:          Apache Ant(TM) version 1.9.6 compiled on July 8 2015
JVM:          1.7.0_95 (Oracle Corporation 24.95-b01)
OS:           Linux 4.2.0-23-generic amd64
1 Answers
Related