How to setup Ionic and Cordova



1. What is Cordova and Ionic?

What is Cordova? Overview. Apache Cordova is an open-source mobile development framework. It allows you to use standard web technologies – HTML5, CSS3, and JavaScript. You can read more detail here: https://cordova.apache.org/docs/en/latest/guide/overview/

What is Ionic? Ionic is an HTML5 mobile app development framework targeted at building hybrid mobile apps. Hybrid apps are essentially small websites running in a browser shell in an app that have access to the native platform layer You can read more detail here: http://ionicframework.com/docs/v1/guide/preface.html

Why do I choose Ionic? Ionic has a great powerful community and support. You can easily use Cordova to build your ionic app into mobile app. Who used to use Angular will feel comfortably with Ionic.

2. How to setup Cordova and Ionic

Very simple, firstly, you need to install Node js. Then follow these steps:

npm install -g cordova && npm install -g ionic

Notice: Do not install above by using “sudo”, it will lead to android and java path conflict problem.

In case ERROR: When displaying an error such as do not have permission on some files of node or npm modules, you can set file permission by your user_name. Example type this:

sudo chown -R mrwen /usr/lib/node_modules    # with "mrwen" is my host name

Now you’ve granted permission of the files without typing ‘sudo’. Whenever you meet any files with have no permission, you can you this command to resolve it.

Now you’ve installed Cordova and Ionic completely.

3. How to build an example app with Ionic and Cordova

After installed complete. Create your first app.

$ ionic start helloWorld
$ cd helloWorld
$ ionic serve

Then view it on browser

More detail here: http://ionicframework.com/docs/intro/tutorial/

Above tutorial link has a tutorial how to deploy app to other Android, iOS. But in order to build it into *.apk file with Android app. You need to install Android SDK and bunch of boring things.

I recommend to use Genymotion to test your app.

In the next tutorial, I will help you how to install Android SDK and tackle common problems when installing.

Leave a Reply

Your email address will not be published. Required fields are marked *