Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error on adding platform in Ionic Framework on Windows

I get the following error while adding the Android platform. I had checked my ant -version and it outputted it correctly. Also, I noticed when it created the myApp folder node_modules wasn't fetched with it. Beneath is output from my console:

Adding platform android
Creating android project...

C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:126
                    throw e;
                          ^
Error: An error occurred while listing Android targets
    at C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\lib\check_reqs.js
:87:29
    at _rejected (C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\node_m
odules\q\q.js:808:24)
    at C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.
js:834:30
    at Promise.when (C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\nod
e_modules\q\q.js:1079:31)
    at Promise.promise.promiseDispatch (C:\Users\Riliwan\.cordova\lib\android\co
rdova\3.5.0\bin\node_modules\q\q.js:752:41)
    at C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.
js:574:44
    at flush (C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\node_modul
es\q\q.js:108:17)
    at process._tickCallback (node.js:419:13)
Error: C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Comma
nd failed with exit code 8
    at ChildProcess.whenDone (C:\Users\Riliwan\AppData\Roaming\npm\node_modules\
cordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:753:16)
    at Process.ChildProcess._handle.onexit (child_process.js:820:5)
Unable to add platform android. Please see console for more info.
like image 933
Riliwan Balogun Avatar asked May 30 '14 18:05

Riliwan Balogun


People also ask

Does ionic work on Windows?

Ionic Windows features:A single API across iOS, Android, Web, and now Windows for maximum code reuse and platform compatibility.

What platforms does ionic support?

Ionic apps are truly cross-platform: able to run as an Android, iOS, Electron, and Progressive Web App (PWA), all from a single codebase. There are some points to keep in mind when optimizing an app to work across these platforms.


1 Answers

I'm using Ubuntu 14.04 and fixed it by setting these paths to the O.S. Path:

export ANDROID_HOME=/home/coutinho/android-sdk 
export ANDROID_TOOLS=/home/coutinho/android-sdk/tools/  
export ANDROID_PLATFORM_TOOLS=/home/coutinho/android-sdk/platform-tools/

PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS:.

Then it worked fine.

like image 86
Rafael Coutinho Avatar answered Sep 20 '22 21:09

Rafael Coutinho