简体   繁体   English

PhoneGap Cordova构建错误退出代码2

[英]PhoneGap Cordova Build Error Exit Code 2

I'minstalled PhoneGap and made one simple app that works on my tablet when using PhoneGap server and PhoneGap App for android. 我安装了PhoneGap,并制作了一个简单的应用程序,该应用程序在使用PhoneGap服务器和Android版PhoneGap应用程序时可在平板电脑上使用。 Now I want to makean APK but I'm gatting error when run sudo phonegap build android in APP folder: 现在我想制作一个APK,但在APP文件夹中运行sudo phonegap build android时出现错误:

miljan@Miljan-PC:~/Desktop/HelloWorld$ sudo phonegap build android [sudo] password for miljan: [phonegap] executing 'cordova build android'... cp: no such file or directory: /home/miljan/Desktop/HelloWorld/icon.png miljan @ Miljan-PC:〜/ Desktop / HelloWorld $ sudo phonegap构建android的[sudo]密码miljan:[phonegap]执行'cordova build android'... cp:无此类文件或目录:/ home / miljan / Desktop /的HelloWorld /的icon.png

Running command: /home/miljan/Desktop/HelloWorld/platforms/android/cordova/build 运行命令:/ home / miljan / Desktop / HelloWorld / platforms / android / cordova / build

[Error: ANDROID_HOME is not set and "android" command not in your PATH. [错误:未设置ANDROID_HOME,并且PATH中未包含“ android”命令。 You must fulfill at least one of these conditions.] 您必须至少满足以下条件之一。]

ERROR building one of the platforms: Error: /home/miljan/Desktop/HelloWorld/platforms/android/cordova/build: Command failed with exit code 2 You may not have the required environment or OS to build this project 建立平台之一时出错:错误:/ home / miljan / Desktop / HelloWorld / platforms / android / cordova / build:命令失败,退出代码2您可能没有所需的环境或操作系统来构建此项目

Error: /home/miljan/Desktop/HelloWorld/platforms/android/cordova/build: Command failed with exit code 2 at ChildProcess.whenDone (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23) at ChildProcess.EventEmitter.emit (events.js:98:17) at maybeClose (child_process.js:743:16) at Process.ChildProcess._handle.onexit (child_process.js:810:5) 错误:/ home / miljan / Desktop / HelloWorld / platforms / android / cordova / build:命令失败,退出代码为ChildProcess.whenDone(/ usr / local / lib / node_modules / phonegap / node_modules / cordova / node_modules / cordova-lib /src/cordova/superspawn.js:134:23(位于ChildProcess.EventEmitter.emit(events.js:98:17))位于Process.ChildProcess._handle.onexit(child_process。 JS:810:5)

In ~/.profile I have add this: 在〜/ .profile中,我添加了以下内容:

export ANDROID_HOME=/home/miljan/Android-SDK-Linux
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platforms-tools

How I can slove this problem? 我该如何解决这个问题? Anyone who can help? 谁能帮忙?

I had the same problem when I was using ionic to build android. 当我使用ionic来构建android时,我遇到了同样的问题。 I used this solution to solve my problem 我用这个解决方案来解决我的问题

Error: ANDROID_HOME is not set and "android" command not in your PATH. 错误:未设置ANDROID_HOME,并且PATH中未包含“ android”命令。 You must fulfill at least one of these conditions. 您必须至少满足以下条件之一。

use the third solution and don't use the exact paths which are given here. 请使用第三个解决方案,不要使用此处给出的确切路径。 In the android_home give the path of your sdk. 在android_home中,提供您SDK的路径。 in the android_tools give the path of tools in the sdk and in the third give the platform path given in the sdk. 在android_tools中给出了SDK中工具的路径,在第三个中给出了SDK中平台的路径。

and if you have problem after this too user chmod 777 /sdk/tools and chmod 777 /sdk/tools/android . 并且如果您在此之后也遇到问题,请使用chmod 777 / sdk / toolschmod 777 / sdk / tools / android

May this solution helps 可能这个解决方案有帮助

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

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