In to the wild..!! (Cross-platform mobile application development)

Let's discuss about something interesting (not related to Java) today."Cross-platform mobile application development". I got an opportunity to look into cross platform application development and I thought of sharing the knowledge I gathered with you as there are no sufficient amount of tutorials online on how to start cross platform application development.

Cross-platform mobile development is the creation of apps that are compatible with multiple mobile operating systems.Originally, the complexity of developing mobile apps was compounded by the difficulty of building out a back end that worked across multiple platforms. Although it was time consuming and expensive, it was often easier to build native applications for each mobile operating system (OS), even though very little code that was written for each operating system could be re-purposed.

There are several tools in the market that we can use to develop cross platform mobile applications.

If you want to do some real job without using a funky GUI you can use Apache Cordova for your development.The reason I like Cordova very much is that it's super easy to configure,it's opensource ,it's lightweight and not affects the memory of the development environment at a great extent.So we'll see how to setup Apache Cordova in a windows environment for android application development.

   1.First we need to install the Cordova CLI
  • Download and install Node.js. On installation you should be able to invoke node and npm on your command line.
  • (Optional) Download and install a git client, if you don't already have one. Following installation, you should be able to invoke git on your command line. The CLI uses it to download assets when they are referenced using a url to a git repo.
  • Install the cordova module using npm utility of Node.js. The cordova module will automatically be downloaded by the npm utility.
  • After completing above steps use  npm install -g cordova in command line to install cordova.
   2.Set the environment variables JAVA_HOME and ANDROID_HOME
  • Download Java JDK here and install. Go to environment variables and create a new variable JAVA_HOME and add the jdk path.Set path variable.  
  • Download Android SDK here and install.Go to environment variables and create a new variable ANDROID_HOME and add the sdk path path.Set path variable.  
   3.Add platforms you need to develop your application as follows


cordova platform add ios --save
cordova platform add android --save

   4.Now the environment is set up.Execute the following command on a directory that you want to    create.
  • cordova create app com.example.app HelloWorld
  • You can see in the sub-directory "app" there's a file HelloWorld created with some folders in it.(A default app is created inside your project folder and now you can build the app.)
  5.Build the application
  • Either using cordova build or  cordova build android you can build the app.Note that the first command will build your application for all the platforms specified while second command only build for android operating systems.
  6.Test the app
  • You can test the app using cordova emulate android command.Here you may encounter a problem like "No AVD found" or "No system Image found".The solution is simple go to android-sdk\tools and open the android.bat file. Download the the APIs for Android Versions including their System Images.Go to android-sdk\AVDManager and create an emulator and run the emulate command again.
Cool you can see the emulator pops up and run your first helloworld application.

Comments

  1. I just want to say that all the information you have given here is awesome...great and nice blog thanks sharing. Thank you very much for this one. And I hope this will be useful for many people.. and I am waiting for your next post keep on updating these kinds of knowledgeable things...

    xamarin development company

    ReplyDelete
  2. This is really helpful and informative, as this gave me more insight to create more

    ideas and solutions for my plan.keep update with your blog post.

    Website Design Company in Bangalore
    Website Development Company in Bangalore

    ReplyDelete

Post a Comment