0

I'm trying to create a prgetto Cordova. The problem is when I go to add the Android platform. 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.

francisco
  • 5
  • 5

3 Answers3

1

You are using the wrong command. Use
cordova platform add android

Morry
  • 726
  • 4
  • 11
  • So, seems that you have to setup an environment variable called ANDROID_HOME in which you have to insert the path of the Android SDK. – Morry Mar 02 '15 at 15:31
  • I can not figure out where to add it. Is putting me in a little trouble. – francisco Mar 02 '15 at 16:27
  • Try this command line instructions: `set ANDROID_HOME=C:\\android-sdk-windows` and then `set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools` – Morry Mar 03 '15 at 08:30
  • The problem is that in the SDK version I downloaded, the platform-tools folder does not exist. There are only platroms and tools – francisco Mar 03 '15 at 11:22
1

Set the ANDROID_HOME environment variable to point to your Android SDK installation.

Then run this command:

cordova platform add android
Robin Eisenberg
  • 1,836
  • 18
  • 26
0

You should follow the official guide.

  1. You need to install the Android SDK
  2. You have to add android tools to your PATH environment variable

You can do it by adding (and adapting) this to your /home/francesco/.bashrc:

PATH = $PATH:/home/francesco/android-sdk/platform-tools:/home/francesco/android-sdk/tools
Gorcyn
  • 2,807
  • 1
  • 20
  • 22