Hi,
I heard about IonicFramework and trying to learn and use it for my one of the project. I am using this for the first time.
I installed cordova and started a new ionic project following your tutorial:
sudo ionic start projectName blank
It was successful, however I’m getting the following error when trying to add android platform:
sudo ionic platform add android
Running platform task...
Adding platform android
Creating android project...
/home/tushar/.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 /home/tushar/.cordova/lib/android/cordova/3.5.0/bin/lib/check_reqs.js:87:29
at _rejected (/home/tushar/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:808:24)
at /home/tushar/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:834:30
at Promise.when (/home/tushar/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:1079:31)
at Promise.promise.promiseDispatch (/home/tushar/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:752:41)
at /home/tushar/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:574:44
at flush (/home/tushar/.cordova/lib/android/cordova/3.5.0/bin/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:415:13)
Error: /home/tushar/.cordova/lib/android/cordova/3.5.0/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:131: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)
Unable to add platform android. Please see console for more info.
I googled for the solution and found some useful suggestions but none of them solved.
I have added the path to android sdk, ant etc on ./bashrc file as following:
When I run sudo apt-get install ia32-libs , I get the following message:
Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
lib32z1 lib32ncurses5 lib32bz2-1.0
E: Package 'ia32-libs' has no installation candidate
There are a number of sources suggesting ia32-libs is needed on 64 bit Ubuntu, but only the below are actually needed.
sudo apt-get install -y libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386 Reference
Also, I installed Ant via the Ubuntu software center, so my path is as follows in the .bashrc:
export ANT_HOME=/usr/share/ant
I seem to be having the same issue as the OP. I followed the Ionic installation guide and the “Comprehensive guide…” and as far as I can tell everything is installed correctly. I can run adb from the terminal as well as ant. Is there something else I can check? I can initialize the project but when I try to: sudo ionic platform add android i get that same error.
Would really like to try ionic out on this new project, any help is appreciated.
From the terminal just run android (SDK Manager) and install at least android-19 target (Android 4.4.2 API-19). You can iinstall more. This requires Internet connection for the download and installation to continue.
After this installation, verify that ant is installed and that you have a working jdk. Make sure not more than one is active. use sudo update-alternatives ... for that.
Not sure what fixed it, but after posting (and before your reply) I had moved the sdk into my home path and updated my .profile (was previously pointing to original tools/platform-tools paths). I then installed android-19 target (only had android-20 target installed). I’m sure I did 100 other things, but those are the significant changes I recall and now I can run ionic platform add android and it works!
Now, when I try to run ionic emulate android I get a “PANIC: Cannot open GalaxyS3”. This is the device I setup using the android avd tools. This is probably something I should ask in the android dev forums as I can’t even launch the device from the android device manager.
I hate to dig up a dinosaur here, but for anyone looking at this in the future, I made a script that will accomplish this in Ubuntu:
It will download and install everything required for Ionic Framework development. It works for 64-bit and 32-bit installs and has been tested specifically on 14.04.
I can confirm that moving the andoid sdk in home directory could be a solution. if ANDROID_HOME is not set, cordova will look in the home/android-sdk folder