PhoneGap - Cordova构建android faild

时间:2016-01-27 13:13:49

标签: android cordova

我是phonegap的新手。当我尝试用cordova构建时,我遇到了这个问题:

  

sudo cordova build android

这是日志:

Running command: /home/paul/Documents/Projets/tozer0-app/platforms/android/cordova/build 
[Error: Failed to find 'JAVA_HOME' environment variable. Try setting setting it manually.]
ERROR building one of the platforms: Error: /home/paul/Documents/Projets/tozer0-app/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/paul/Documents/Projets/tozer0-app/platforms/android/cordova/build: Command failed with exit code 2

有什么想法吗?

1 个答案:

答案 0 :(得分:-1)

只需将JAVA_HOME,ANDROID_HOME和ANT_HOME添加到路径并指出相应的bin目录: 对于android studio

将此添加到〜/ .bashrc文件中:

  1. export ANDROID_HOME = / path / to / android / SDK
  2. export PATH = $ PATH:$ ANDROID_HOME / bin
  3. 你可以为Ant做同样的事情。 对于java jdk

    将其添加到/ etc / profile文件中:

    1. JAVA_HOME = /路径/到/ JDK
    2. JRE_HOME = $ JAVA_HOME / JRE
    3. PATH = $ PATH:$ JAVA_HOME / bin中:$ JRE_HOME / bin中
    4. 导出JAVA_HOME
    5. 导出JRE_HOME
    6. export PATH
    7. 现在在终端中输入echo $ PATH并确保将所有环境变量添加到PATH中!