简体   繁体   English

在创建android子项目期间发生错误

[英]An error occured during creation of android sub-project

I installed cordova e phonegap via npm install -g cordova and npm install -g phonegap respectively. 我分别通过npm install -g cordovanpm install -g phonegap安装了cordova e phonegap。 Then i created a HelloWorld application via cordova create HelloWorld mynamespace.helloworld HelloWorld . 然后我通过cordova创建了一个HelloWorld应用程序, 创建了HelloWorld mynamespace.helloworld HelloWorld It worked fine! 它工作正常! Then i changed my working directory to HelloWorld and i tried to build the app for android via cordova platform add android -d but it didn't work. 然后我将我的工作目录更改为HelloWorld,我尝试通过cordova平台添加android -d为Android构建应用程序,但它无法正常工作。 here is the output: 这是输出:

Installing cordova library for android...
Requesting {"uri":"https://git-wip-us.apache.org/repos/asf?p=cordova-android.git;a=snapshot;h=3.3.0;sf=tgz"}...
Downloading cordova library for android...
Downloaded, unzipped and extracted 541065 byte response.
Download complete
Installing cordova library for android...
Checking if platform "android" passes minimum requirements...
Creating android project...
Running bin/create for platform "android" with command:     ""C:\Users\marcos.pacheco\.cordova\lib\android\cordova\3.3.0\bin\create"  "C:\Dev\HelloWorld\platforms\android" "mynamespace.helloworld" "HelloWorld"" (output to follow)


C:\Users\marcos.pacheco\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:126
                throw e;
                      ^
Error: An error occured during creation of android sub-project.

at C:\Users\marcos.pacheco\AppData\Roaming\npm\node_modules\cordova\src\platform.js:244:30
at exithandler (child_process.js:633:7)
at ChildProcess.errorhandler (child_process.js:649:5)
at ChildProcess.EventEmitter.emit (events.js:95:17)
at Process.ChildProcess._handle.onexit (child_process.js:787:12)

I've googled and have found some issues with whitespaces but my project is in the C:\\Dev\\HelloWorld path and my android sdk is in the PATH so that when i type adb at the windows prompt i get the help information of the command as well Java and Ant. 我用google搜索并发现了一些空白问题,但我的项目是在C:\\ Dev \\ HelloWorld路径中,我的android sdk在PATH中,所以当我在windows提示符下键入adb时,我会得到命令的帮助信息还有Java和Ant。 Furthermore, i have ANT_HOME , JAVA_HOME and ANDROID_HOME set. 此外,我设置了ANT_HOMEJAVA_HOMEANDROID_HOME I also deleted the ** .cordova ** folder inside my %HOMEPATH% directory and entered the command again but the error is still there. 我还删除了%HOMEPATH%目录中的** .cordova **文件夹并再次输入命令,但错误仍然存​​在。

What might be wrong? 可能有什么问题?

XCOPY needs to be defined and found on your path as it is used by the internal node.js scripts to move things around. 需要在路径中定义和找到XCOPY,因为内部node.js脚本使用它来移动东西。

You probably already have xcopy.exe somewhere on your machine. 您可能已经在计算机上的某个位置安装了xcopy.exe。 You should be able to add %SystemRoot%\\System32 to your PATH and it will work. 您应该能够将%SystemRoot%\\System32添加到PATH中,它将起作用。 Or you can open up a terminal and type where xcopy to see the actual path to your xcopy.exe. 或者,您可以打开终端并where xcopy键入以查看xcopy.exe的实际路径。

I guess having XCOPY on the path is a requirement for setting up and installing Android, but it'd be nice if Cordova checked to make sure you have XCOPY somewhere... 我想在路径上安装XCOPY是设置和安装Android的必要条件,但如果Cordova检查确保你在某个地方有XCOPY,那就太好了......

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

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