[英]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.