简体   繁体   English

尝试构建Android应用程序时,Cordova失败,错误为“命令失败,退出代码2”,Linux

[英]Cordova fail when try to build Android app with error “Command failed with exit code 2” Linux

I'm using Ubuntu Gnome 14.04 64 Bit (for the moment) with kernel 3.19.0-33-generic. 我正在将Ubuntu Gnome 14.04 64 Bit(目前)与内核3.19.0-33-generic一起使用。

I created a new app (a clean one, no plugin, no www folder with content) to try to build it. 我创建了一个新应用程序(一个干净的应用程序,没有插件,没有包含内容的www文件夹)以尝试构建它。 After type in the bash "cordova build android" I get this error: 键入bash“ cordova build android”后,出现此错误:

Running command: /home/aby/Desktop/testApp/platforms/android/cordova/build 
[Error: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.]
ERROR building one of the platforms: Error:/home/aby/Desktop/testApp/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/aby/Desktop/testApp/platforms/android/cordova/build: Command failed with exit code 2

Now if you printenv | grep android 现在,如果您printenv | grep android printenv | grep android

You will get 你会得到

ANDROID_HOME=/opt/android-sdk-linux
ANDROID_PLATFORM_TOOLS=/opt/android-sdk-linux/platform-tools
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools:/home/aby/bin:/home/aby/opt/jdk8/jdk1.8.0_45/bin:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools
ANDROID_SDK=/opt/android-sdk-linux

You can see that the variables exist, in fact before I run cordova build android I had to use cordova platform add android and its works with no problem. 您可以看到变量存在,实际上在我运行cordova build android我不得不使用cordova platform add android及其工作没有问题。

So I found this Bug , and tried some solution like update android(project) or remove and install it again with no success. 因此,我发现了这个Bug ,并尝试了一些解决方案,例如update android(project)或将其删除并再次安装没有成功。

I reinstall the Andoroid SDK, and updated the "/.bashrc", "/.profile" and "~/.pam_enviroment" with the environment values and also this not help. 我重新安装Andoroid SDK,并使用环境值更新了“ /.bashrc”、“/.profile”和“〜/ .pam_enviroment”,这也无济于事。

So how can I fix this? 那么我该如何解决呢? How can I build my app with no error? 如何构建我的应用程序而不会出现错误? What I missing?(If you consider that you need another information please tell me). 我想念的是什么(如果您认为您需要其他信息,请告诉我)。

Thanks, in advance. 提前致谢。

At the end I could fix my problem when I change the "Owner" / "Group" to the android sdk folder and Permission to "/tools/android". 最后,当我将“所有者” /“组”更改为android sdk文件夹,将权限更改为“ / tools / android”时,我可以解决我的问题。

Here a link to my previous question, and the solution (at least for me) to fix this error. 这里是我以前的问题的链接,以及(至少对我来说)解决此错误的解决方案。

暂无
暂无

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

相关问题 cordova build android 错误:系统找不到指定的路径。 错误:cmd:命令失败,退出代码为 1 - cordova build android error : The system cannot find the path specified. Error: cmd: Command failed with exit code 1 在Android模拟器上运行Cordova错误:“android:命令失败,退出代码为2” - Cordova error running on android emulator: “android: Command failed with exit code 2” Cordova版本:命令失败,退出代码为8 - Cordova build: Command failed with exit code 8 cordova / platforms / android / gradlew:命令失败,退出代码为1错误输出: - cordova /platforms/android/gradlew: Command failed with exit code 1 Error output: Cordova-错误:cmd:命令失败,退出代码为1 - Cordova - Error: cmd: Command failed with exit code 1 无法使用build.bat在Cordova 5.0.0中构建Android平台:命令失败,退出代码为8 - Can't build Android platform in Cordova 5.0.0 with build.bat: Command failed with exit code 8 Ionic Android Build Error:cmd:命令失败,退出代码为1 [解决方案] - Ionic Android Build Error: cmd: Command failed with exit code 1 [solution] 流星建筑失败Cordova应用程序的平台Android:命令的错误代码1: - meteor building failed Cordova app for platform Android: Error code 1 for command: Cordova / PhoneGap-生成命令的错误代码1 - Cordova/PhoneGap - Build failed Error code 1 for command 在Android设备抛出命令上从Visual Studio 2013调试Cordova应用失败,退出代码为2 - Debug cordova app from Visual Studio 2013 on Android Device throwing Command failed with exit code 2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM