简体   繁体   English

科尔多瓦添加Android平台

[英]Cordova add Android platform

I'm trying to create a prgetto Cordova. 我正在尝试创建一个Prgetto Cordova。 The problem is when I go to add the Android platform. 问题是当我去添加Android平台时。 After this command: 执行此命令后:

cordova add Android platform

I have an answer from the shell this message: 我从外壳得到了以下消息的答案:

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)

I looked around but I could not solve. 我环顾四周,但无法解决。 Can someone help me? 有人能帮我吗? There rinngrazio in advance. 事先有rinngrazio。

You are using the wrong command. 您使用了错误的命令。 Use 采用
cordova platform add android

Set the ANDROID_HOME environment variable to point to your Android SDK installation. 设置ANDROID_HOME环境变量以指向您的Android SDK安装。

Then run this command: 然后运行以下命令:

cordova platform add android

You should follow the official guide . 您应该遵循官方指南

  1. You need to install the Android SDK 您需要安装Android SDK
  2. You have to add android tools to your PATH environment variable 您必须将android工具添加到PATH环境变量中

You can do it by adding (and adapting) this to your /home/francesco/.bashrc: 您可以通过将其添加(修改)到/home/francesco/.bashrc中来实现:

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

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

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