1

I have installed ionic, cordova and android. But ionic is not creating android project. I have attached the error.

C:\Users\shri\myapp>ionic platform add android Creating android project... C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\package\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 C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\lib\check_reqs.js:158:19 at _fulfilled (C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:798:54) at self.promiseDispatch.done (C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:827:30) at Promise.promise.promiseDispatch (C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:760:13) at C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:821:14 at flush (C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_modules\q\q.js:108:17) at process._tickCallback (node.js:419:13) at Function.Module.runMain (module.js:499:11) at startup (node.js:119:16) at node.js:906:3 Error: C:\Users\shri.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\create.bat: Command failed with exit code 8 at ChildProcess.whenDone (C:\Users\shri\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23) at ChildProcess.emit (events.js:98:17) at maybeClose (child_process.js:756:16) at Process.ChildProcess._handle.onexit (child_process.js:823:5)

user2820823
  • 86
  • 1
  • 1
  • 9
  • 1
    I had this exact same thing. Error message is not helpful. I ran "cordova platform add android" and it said I needed API 19, which I found out here http://stackoverflow.com/questions/20677999/cordova-please-install-android-target-19 – Mark Robson Sep 25 '14 at 11:12
  • 1
    @MarkRobson : That tutorial helped me. I was having the problem of path variables. I dint include platform-tools path in the environment variable before. Now it works. Thank You. – user2820823 Sep 27 '14 at 11:17

1 Answers1

0

You need to include ANDROID_HOME in your PATH. I recommend you do the following (assuming you're on Windows 8.1):

Right click the tile launcher icon in your task bar and choose system. In the window that pops up, choose Advanced system settings on the left. In the System Properties window click the Environment Variables button and choose to add a new system variable. For the name choose ANDROID_HOME and for the value include the full path to your Android SDK directory.

Edit the PATH variable and add the following to the end of the value:

;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

Restart your windows session and it should work now.

Nic Raboy
  • 3,143
  • 24
  • 26