Cordova添加Android平台

时间:2015-03-02 15:16:13

标签: android cordova platform

我正在尝试创建一个prgetto Cordova。问题是当我去添加Android平台时。 执行此命令后:

cordova add Android platform

我从shell获得了这条消息的答案:

Creating Android project ...

    /home/francesco/.cordova/lib/android/cordova/3.6.4/bin/node_modules/q/q.js:126
                        throw e;
                              ^
    Error: ANDROID_HOME is not set and "Android" command not in your PATH. You must Fulfill at least one of These conditions.
        at /home/francesco/.cordova/lib/android/cordova/3.6.4/bin/lib/check_reqs.js:159:19
        at _fulfilled (/home/francesco/.cordova/lib/android/cordova/3.6.4/bin/node_modules/q/q.js:798:54)
        at self.promiseDispatch.done (/home/francesco/.cordova/lib/android/cordova/3.6.4/bin/node_modules/q/q.js:827:30)
        at Promise.promise.promiseDispatch (/home/francesco/.cordova/lib/android/cordova/3.6.4/bin/node_modules/q/q.js:760:13)
        at /home/francesco/.cordova/lib/android/cordova/3.6.4/bin/node_modules/q/q.js:821:14
        at flush (/home/francesco/.cordova/lib/android/cordova/3.6.4/bin/node_modules/q/q.js:108:17)
        at process._tickCallback (node.js: 415: 13)
        at Function.Module.runMain (module.js: 499: 11)
        at startup (node.js: 119: 16)
        at node.js: 902: 3
    Error: /home/francesco/.cordova/lib/android/cordova/3.6.4/bin/create: Command failed with exit code 8
        at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135: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)
我环顾四周但是无法解决。有人能帮我吗?有rinngrazio提前。

3 个答案:

答案 0 :(得分:1)

您使用的是错误的命令。使用
cordova platform add android

答案 1 :(得分:0)

将ANDROID_HOME环境变量设置为指向Android SDK安装。

然后运行此命令:

cordova platform add android

答案 2 :(得分:0)

您应该关注官方guide

  1. 您需要安装Android SDK
  2. 您必须将android工具添加到PATH环境变量
  3. 您可以通过在/home/francesco/.bashrc中添加(并调整)它来实现:

    PATH = $PATH:/home/francesco/android-sdk/platform-tools:/home/francesco/android-sdk/tools