简体   繁体   English

meteor运行android-spawn来自Cordova的ENOENT和gradle错误

[英]meteor run android- spawn ENOENT and gradle errors from Cordova

I am attempting to run a Meteor project on an Android device and/or emulator. 我试图在Android设备和/或模拟器上运行Meteor项目。 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. 当我运行meteor run --verbose androidmeteor run --verbose android-device ,我得到与Cordova相关的错误,无法找到某些gradle文件。 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 $ANDROID_HOME/tools/template/gradle/wrapper没有目录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 . 同样,我的~/simple-todos/.meteor/local/cordova-build/platforms/android/gradle/wrapper目录中根本没有文件,所以没有gradle-wrapper.properties

I'm also quite uncertain about the meaning of the spawn ENOENT error. 我也很不确定spawn ENOENT错误的含义。

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. 编辑 :我想在我的机器上测试gradle工作,所以我在Android Studio中制作了一个应用程序并在我的手机上运行 - 工作正常。 My Meteor project still doesn't run on Android, but I think this tells me that gradle is working (somewhere) on my computer. 我的Meteor项目仍然无法在Android上运行,但我认为这告诉我gradle在我的计算机上工作(某处)。

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 ). 编辑 :我在我的计算机上搜索了一个gradlew目录,我发现的只有一个在android-studio ,而不是我的$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 -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

Initial disclaimer: I'm not super familiar with the particular tools you are using on top of the android+gradle, but I'll try to help as best I can. 最初的免责声明:我不是非常熟悉你在android + gradle上使用的特定工具,但我会尽力帮助你。

This is worth reading: https://docs.gradle.org/current/userguide/gradle_wrapper.html 这值得一读: https//docs.gradle.org/current/userguide/gradle_wrapper.html

Also, you probably want to get gradle setup on your system first, and double check that gradle home is set (*not always necessary, but depends on what other things like android studio, etc. pull in automagically): https://docs.gradle.org/current/userguide/installation.html 此外,您可能希望首先在系统上进行gradle设置,并仔细检查gradle home是否已设置(*并非总是必要,但取决于其他内容如android studio等自动引入): https:// docs .gradle.org /电流/ userguide / installation.html

My guess is that the tooling you are using is trying to find the system gradle and/or gradlew it expects to have available within your project...and that it is getting mixed up. 我的猜测是你正在使用的工具是试图找到它希望在你的项目中可用的系统gradle和/或gradlew ......而且它正在混淆。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM