0

I'm running Ionic on Ubuntu. I have the Android sdk installed and already installed the tools to work with it.

When I try to run ionic build android I got the error:

Running command: /home/fernando/Dropbox/Code/Kelps/KelpsApp/platforms/android/cordova/build 
[Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.]
ERROR building one of the platforms: Error: /home/fernando/Dropbox/Code/Kelps/KelpsApp/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/fernando/Dropbox/Code/Kelps/KelpsApp/platforms/android/cordova/build: Command failed with exit code 2
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

I'm tried to look this on google, and have too much information and no solution about this.

Someone already got this error?

Thanks!

Fernando Aureliano
  • 894
  • 12
  • 35

2 Answers2

0

Yes, I have met this error before. But as your log we can see what the problem is:

Error: ANDROID_HOME is not set and "android" command not in your PATH. You must fulfill at least one of these conditions.

You have installed the sdk but haven't set the PATH to it.

For Windows user try the following step:

  • Open up the System Environment from:
  • Control Panel -> System -> Advanced system settings -> Select Advance tab
  • Click on Environment Variables...
  • In the User variables for ... section click on the New button.
  • Then type ANDROID_HOME in Variable name, and the path to the sdk folder in Variable Value
  • OK, OK, OK
  • Restart the command line and try again with ionic command.

For Ubuntu, I don't use this OS so please check this solution

Community
  • 1
  • 1
Nam Pham
  • 1,224
  • 13
  • 38
0

Find my answer at this post :

https://www.thepolyglotdeveloper.com/2014/09/install-android-cordova-ionic-framework-ubuntu/

Nic Raboy
  • 3,143
  • 24
  • 26
Fernando Aureliano
  • 894
  • 12
  • 35