Following the getting started instructions, I'm running into this error on step 3 when I try to run: ionic platform add android
My server is Ubuntu 14.04 LTS
Either cd into your project directory or update cordova :)
@Jorenm did that help? If not, could you provide more information about the steps necessary to reproduce?
Hey @Jorenm, since it's been a few weeks without a reply, I'm going to assume that did the trick. Let me know if that's not the case though.
I'm in Ubuntu 14.04 and following the "Getting Started with Ionic" guide I'm stumbling with the same problem.
Problem is with step 3.
I cd into my app and when I try to add a platform I get the next message:
Current working directory is not a Cordova-based project.
Error from platform command.
platform [options] <PLATFORM> ................. Add platform target for building an Ionic app
It seems I might be missing something since the directory only contains this two files:
drwxrwxr-x 7 x x 4.0K ago 3 03:35 ionic-app-base-master
-rw-rw-r-- 1 x x 38 ago 3 03:35 ionic.project
I just updated ionic and cordova and am getting the same error when attempting to "ionic platform add android"
cordova 3.4.0-0.1.3
Oh, I just saw everything is under ionic-app-base-master, so cd into ionic-app-base-master and seems to run fine now.
Ubuntu 14.04 64bit, just update to latest ionic.
I'm still getting an error after changing directory, for android:
> cd ionic-app-base-master/
> ionic platform add android
Downloading cordova library for android...
Download complete
Creating android project...
/home/x/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:126
throw e;
^
Error: An error occurred while listing Android targets
at /home/x/.cordova/lib/android/cordova/3.5.1/bin/lib/check_reqs.js:87:29
at _rejected (/home/x/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:808:24)
at /home/x/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:834:30
at Promise.when (/home/x/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/home/x/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:752:41)
at /home/x/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:574:44
at flush (/home/x/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:343:11)
Error: /home/x/.cordova/lib/android/cordova/3.5.1/bin/create: Command failed with exit code 1
at ChildProcess.whenDone (/home/x/.nvm/v0.11.13/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.EventEmitter.emit (events.js:118:17)
at maybeClose (child_process.js:992:16)
at Process.ChildProcess._handle.onexit (child_process.js:1059:5)
For ios:
> ionic platform add ios
Downloading cordova library for ios...
Download complete
Creating ios project...
/home/x/.cordova/lib/ios/cordova/3.5.0/bin/create: 33: /home/x/.cordova/lib/ios/cordova/3.5.0/bin/create: Syntax error: "(" unexpected
Error: /home/x/.cordova/lib/ios/cordova/3.5.0/bin/create: Command failed with exit code 2
at ChildProcess.whenDone (/home/x/.nvm/v0.11.13/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.EventEmitter.emit (events.js:110:17)
at maybeClose (child_process.js:992:16)
at Process.ChildProcess._handle.onexit (child_process.js:1059:5)
looks like the latest ionic only works with node version 0.11.13
It seems I have that version of node:
> node --version
v0.11.13
And nvm:
> nvm --version
0.11.1
@lobo-tuerto I have exactly same problem with stable node v0.10.30 (on 64bit ubuntu 14.04), have you found any solution?
Not yet, waiting for a reply from @playground or someone. I haven't had the time to look into this and just wanted to play a little bit with the framework on spare time.
Same problem, Ubuntu 14.04x64,
nodejs: v0.10.30
ant : Apache Ant(TM) version 1.9.3 compiled on April 8 2014
Sencha Cmd v5.0.1.231
phonegap: 3.5.0-0.21.14
cawa@cawa [01:43:03] [~/phonegap/SenchaMyApp/phonegap]
-> % phonegap run android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
/home/cawa/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:126
throw e;
^
Error: An error occurred while listing Android targets
at /home/cawa/.cordova/lib/android/cordova/3.5.1/bin/lib/check_reqs.js:87:29
at _rejected (/home/cawa/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:808:24)
at /home/cawa/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:834:30
at Promise.when (/home/cawa/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/home/cawa/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:752:41)
at /home/cawa/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:574:44
at flush (/home/cawa/.cordova/lib/android/cordova/3.5.1/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:419:13)
{ [Error: /home/cawa/.cordova/lib/android/cordova/3.5.1/bin/create: Command failed with exit code 8] code: 8 }
[error] /home/cawa/.cordova/lib/android/cordova/3.5.1/bin/create: Command failed with exit code 8
@lobo-tuerto try to do:
sudo aptitude install -y libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386
and then add android platform to cordova:
cordova platform add android
Now i can run sencha application:
sencha app build -run native

I already has those installed. I just updated the ionic CLI program from 1.1.9 to 1.1.10. Same error.
hmm, works fine for me.
I was fighting with this yesterday more than 4 hours .... Now is working on my ubuntu 14.04 64bit. I made many thinks (may be I forgot something):
I already had installed java-8-oracle, then
$ sudo apt-get install libgl1-mesa-dev:i386
$ sudo apt-get install ant
$ npm install -g cordova ionic
then I download from http://developer.android.com/sdk/index.html
(click on "view all downloads and sizes")
Linux 64-bit adt-bundle-linux-x86_64-20140702.zip
Linux 32 & 64-bit android-sdk_r23.0.2-linux.tgz
extract it somewhere
then I updated ~/.bashrc and add this path:
export JAVA_HOME="/usr/lib/jvm/java-8-oracle"
export ANT_HOME="/usr/share/ant"
export ANDROID_HOME="/home/marek/Software/android-sdk-linux"
export ANDROID_TOOLS="/home/marek/Software/android-sdk-linux/tools"
export ANDROID_PLATFORM_TOOLS="/home/marek/Software/adt-bundle/sdk/platform-tools"
PATH="$PATH:$JAVA_HOME:$ANT_HOME:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS:."
then I run Android SDK manager just type $ android and install all I need
finally I can run one of this without errors in project directory:
$ cordova platform add android
$ ionic platform add android
May be I forgot something because I tried follow many tips from stackoverflow some of them was wrong. I hope it help some of you.
:+1:
Exporting those ANDROID env vars did the trick, thank you!
playground wrote (~ 140816) "looks like the latest ionic only works with node version 0.11.13"
aha.
This issue (at least in my case) centred around not having the android developer tools (SDK) installed on OSX. I installed the standalone android SDK using these instructions - http://developer.android.com/sdk/installing/index.html?pkg=tools
and then ensured the correct folders were on my system path using these instructions for android (under "Requirements" section):
https://www.npmjs.org/package/cordova
Finally, rerunning "ionic platform add android" worked.
Some people trying Ionic come from a webdev background (like me) not from Android.
These links should be provided in the "Getting Started with Ionic" page. Guess it could help.
I am having the same problem and setting up the environment is a huge pain :(
Additional I tried everything explained and still have "Not in the project" msg.
I haven't tried it yet but this can help:
http://www.webupd8.org/2014/09/canonical-releases-ubuntu-developer.html
These instructions need to be written in one place. Currently trying the ubuntu developer studio.
I've experienced the same issue after checking a project that works fine on another machine. Same set up and all, i made sure all of the environment variables were set for Android.
What solved it for me was simply
adding a www folder
I created a brand new project and compared it with the one that was troublesome and it was really the only difference. Once i created the folder cordova seemed to behave normally again.
Hi Guys,
I had the same issue, the missing file between my project was config.xml. Once we had it added, the issue was resolved.
I had the same issue, and the problem went away after I added an empty www folder. The thing is that www is in .gitignore so when you git clone a project everything is there and set up, except www. :D
mkdir www solved the problem for me, too (thanks @devakone!)
I have a different app structure than what cordova creates (and expects).
Most helpful comment
I've experienced the same issue after checking a project that works fine on another machine. Same set up and all, i made sure all of the environment variables were set for Android.
What solved it for me was simply
adding a www folder
I created a brand new project and compared it with the one that was troublesome and it was really the only difference. Once i created the folder cordova seemed to behave normally again.