Unable to add platform ionic platform add Android - ionic-framework

Getting below error when running command ionic platform add android
Error: ENOENT, no such file or directory _____\.cordova\lib\android\cordova\3.5.1\VERSION'

I am providing step by step installation of ionic along with cordova.
Have a look it may help you :
First install node to get started using this link
open cmd to install cordova using following command
$ sudo npm install -g cordova
(Drop sudo from the above command if running on Windows)
install ionic using command
$ sudo npm install -g ionic
Create project after selecting directory where project file will be stored,
through CMD,by following command
ionic start {project name} {template type} e.g
ionic start todo blank
Once your project is created go to your newly created project: cd .\new project. for e.g.
D:\Projects>cd.\todo
Now you have to add both android and ios to your project in order to test the build so you need to follow below commands
ionic cordova platform add android
ionic cordova platform add ios
I think in your case you are missing step 5.

Related

"ionic serve --lab" gives an error for ionic2

I used to create Ionic apps by
ionic start AppName blank --v2 and run with ionic serve --lab.
But now it gives:
"Error: ENOENT: no such file or directory"
What should I do?
I was able to run ionic lab as before after updating ionic. Must be due to a new release.
I just ran below in the terminal.
$ npm uninstall -g ionic
$ npm install -g ionic

Ionic still creates v1 projects even after upgrading v2

I'm trying to start an Ionic v2 project following the official docs here, but I end up with an Ionic v1 project every time. My steps:
Remove current ionic and install the beta:
$ npm uninstall ionic -g
$ npm install ionic#beta -g
/Users/mike/.npm-global/bin/ionic -> /Users/mike/.npm-global/lib/node_modules/ionic/bin/ionic
/Users/mike/.npm-global/lib
└── ionic#2.0.0-beta.32
Create a new Ionic v2 TypeScript project:
$ ionic start ionic2-test --v2 --ts
Creating Ionic app in folder /Users/mike/dev/ionic2-test based on tabs project
Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip
[=============================] 100% 0.0s
Downloading: https://github.com/driftyco/ionic-starter-tabs/archive/master.zip
[=============================] 100% 0.0s
Updated the hooks directory to have execute permissions
Update Config.xml
Initializing cordova project
Adding in iOS application by default
But a v1 project is created:
$ cat ./ionic2-test/www/lib/ionic/version.json
{
"version": "1.3.1",
"codename": "el salvador",
"date": "2016-05-12",
"time": "18:21:10"
}
$ head -2 ./ionic2-test/www/lib/ionic/js/angular/angular.js
/**
* #license AngularJS v1.5.3
My ionic info:
Cordova CLI: 5.4.0
Gulp version: CLI version 3.9.0
Gulp local:
Ionic CLI Version: 1.7.8
Ionic App Lib Version: 0.6.4
ios-deploy version: Not installed
ios-sim version: 5.0.3
OS: Mac OS X El Capitan
Node Version: v5.0.0
Xcode version: Xcode 7.3 Build version 7D175
What am I doing wrong?
So, the problem is that the Ionic CLI is not being updated to the latest one (2.0.0 beta-32). Have you tried by doing this:
After $ npm uninstall ionic -g, update npm and clean npm's cache:
npm cache clean -f
npm install npm -g
Delete manually any folder containing references to Ionic like those you've included in the question:
/Users/mike/.npm-global/bin/ionic
/Users/mike/.npm-global/lib/node_modules/ionic/bin/ionic
/Users/mike/.npm-global/lib
And then after that:
$ npm install -g ionic#beta
or (on Mac and Linux you’ll need to add sudo to install Ionic globally):
$ sudo npm install -g ionic#beta
#sebaferreras lead me to the solution.
Even after sudo npm uninstall ionic -g, the ionic command was still available:
$ which ionic
/usr/local/bin/ionic
So I think I must have had it installed in multiple places. There seemed to be something generally screwed up with my node installation (I possibly installed from homebrew as well as from the official .pkg download), so I decided to completely remove it all and start from scratch, as described here:
How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
I then reinstalled node using the official .pkg from their website, su-did npm install -g ionic#beta, and now...
$ ionic info
Ionic CLI Version: 2.0.0-beta.32
Ionic App Lib Version: 2.0.0-beta.18
...
So I'm all fixed up!
this link will solve and save your time: http://ionicframework.com/docs/v2/getting-started/installation/
the simple way to create a ionic project: go to your into the directory where you want to create you project and the type this cmd:
ionic start cutePuppyPics --v2
Your Ionic CLI is not updated yet. Just run the command "npm install ionic cordova" once again, no need to uninstall the previous version manually. It will override the previous version automatically.
Just for your future help: To build you first app in Ionic, You might need to update jdk to 1.8, sdk to latest one from sdk manager (no need to change target sdk) and the first build will download a number of Gradle files, so, good Internet connection is needed.

Cannot start an ionic 2 blank project

I am trying to start an ionic 2 blank project but it always create an ionic 1 project. That's what I do:
npm install -g ionic#beta
ionic start Test --v2
but when I open the project it's still version 1. I have tried to remove ionic completely with:
sudo npm uninstall -g ionic
sudo npm uninstall -g ionic#beta
sudo npm uninstall -g cordova
but after that when I type "ionic" it's showing that I have ionic v1.7.14. (did it several times and there aren't any errors).
for a blank project you can give the following command
ionic start ProjectName blank --v2
for tabs template you can give
ionic start ProjectName tabs --v2
--v2 is for ionic 2 project
you can also include --ts for getting the typescript project
ionic start ProjectName blank --v2 --ts
As of now The --v1 and --v2 flags have been removed.
ionic 1 blank project
ionic start myapp blank --type ionic1
ionic 2 blank project
ionic start myApp blank
ionic 3 blank project
ionic start myapp blank --type ionic-angular
Actually, I found what was wrong. In the documentation it's written:
ionic start Example --v2
where it should be (at least in my case)
ionic start Example -v2
Best tutorial follow the below link
First of install latest Node 6 LTS and NPM 3+ in window machinne.
/>npm install -g ionic#latest
/>ionic start mySampleApp
/>cd ./mySampleApp
/>npm install -g cordova
For android
/>ionic cordova platform add android
For ios
/>ionic cordova platform add ios
/>ionic cordova run android
That’s all if any error or problem comes please comment below.
http://infiniteneed.com/setup-and-start-ionic-mobile-app-from-scratch-in-window-machine/
I believe you will also need ionic#beta - currently 2.0.19
npm install -g ionic#beta
The great thing is, you can still use this CLI to install/control/build Ionic#1.x apps - in fact, there's little difference to the user since Ionic v1 is still the default for ionic#beta.

what is the latest version of ionic build 1.1.0 or 1.6.4

I installed ionic using the following command:
npm install -g ionic
After navigating to node_modules/ionic folder on my local machine and opening the package.json file, it says that the version is 1.6.4
However the ionicframework.com website says the latest version is
1.1.0 "xenon-xerus"
This is quiet confusing. Can someone clarify
You need to differentiate between the ionic CLI (version 1.6.4) and the ionic lib in your application project (version 1.1.0).
if you type ionic -v you'll get the version of the CLI (command line interface)
if you go into your project folder and type ionic lib you'll get the lib version.
Btw: You update the library with ionic lib update
Latest version: 1.7.8
Run npm install -g ionic to update
check version ----
ionic --version
1.7.8
run following command in terminal/cmd: ionic info that command will give you full details of ionic and Cordova installed in your pc and project.
And then you can use npm install -g ionic for install latest ionic build.

Cordova 3.0.0 - How to install a plugin

I'm totally new to app development and just started to make my first steps.
I've installed Cordova and the needed utilities according this guide.
I've created my first app (using Cordova's create script) and I'm able to run it on my Nexus 4.
Now I tried to install a plugin using plugman, and I'm stuck.
This tutorial says I can install a plugin using
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
in the application directory.
Two issues here:
1. In the application directory itself isn't a executable file named "cordova"
2. When I swtich to the cordova directory and execute the mentioned command, I get this error:
Cordova does not recognize the command plugin
Any ideas what I'm doing wrong? Or is ther a mistake in the tutorial?
Thanks a lot for any help!
EDIT:
I managed to install the plugins using plugman directly using
plugman install --platform android --project . --plugin
https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
But nevertheless I'm still interested in how to install the plugins using cordova...
Below are several ways I've used to install plugins from Cordova CLI, hope it helps:
Firstly, make sure you've installed cordova correctly(please refer to official document if needed):
cordova -v // should print something like "3.5.0-0.2.6"
Install from Cordova plugin registry
cordova plugin add org.apache.cordova.device
This should cover most cases and here is a list of plugins available in Cordova Plugin Registry.
Install from a remote repository, typically from GitHub
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin
If you encountered something like "Error: Command failed: error: Failed connect to help.github.com:443; Connection refused while accessing", typically it's a proxy issue, you could retry after config your proxy:
git config --global http.proxy http://user:password#proxy:xxx
If it still not works, you could click "Dowload Zip" from github, unzip the downloaded file and then:
Install from a local directory
cordova plugin add /path/to/directory
It will look in this directory and each of its subdirectories for the plugin.
NOTE: this is related to Android platform of cordova 3.4 on my windows 8 machine (tested)
step 1=> Install plugman by command in cmd "npm install -g plugman" (note that you must have node installed)
step 2=> Download git from http://msysgit.github.com/ for windows (15 mb) install exe file
step 3=> create new variable in enviorment variable name = GIT_PATH and value= "C:\Program Files (x86)\Git (this is mine urs may be diff)", now append %GIT_PATH% in Path variable (very Important) check git command in cmd if no error than continue otherwise fix this now
step 4=> Now go to http://plugins.cordova.io/#/ find whatever plugin want to install. and get just this repository url like
step 5=> now whatever and anywhere project is, place following command in cmd
**plugman install --platform android --project F:\my17app\ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git**
Step 7=> If it successfully install we can see in app/res/xml/config.xml file a new feature will be added with id of new plugin
PS: For environment variables see in control Panel=> System and Security => System =>Advanced System Security
I did it in this manner
D:\phonegap\hello>plugman install --platform android --project D:\phonegap\hello
\platforms\android --plugin org.apache.cordova.battery-status
where as for doing it from git
plugman install --platform android --project D:\phonegap\hello
\platforms\android --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git