Build Native installers using Ionic CLI from your terminal/prompt2 min read

Build Native installers using Ionic CLI

This feature has been deprecated as of Ionic CLI 1.5.5. You will not find the package option in the CLI. Refer: issuecomment-109349399

Ionic recently launched a super awesome service where you can generate native installers write from your terminal/prompt. This service is in beta phase as of Ionic version 1.1.5. In this post, we will take a quick look at how we generate native installers using this service.

We are going to use the code base from Ionic Restify MongoDB – An End to End Hybrid App post. Instead of running the final product through PhoneGap build, we will use Ionic package CLI to generate the installer.

To get started, you can get the code base from GitHub or follow the post and build it yourself. If you are fetching the code from GitHub, create a new folder named ionicPackage and download/clone the code into that folder.

Open terminal/prompt inside the ionicPackage folder and run

git clone https://github.com/arvindr21/BucketListApp.git

and then  cd BucketListApp/dev/client/bucketListApp

Next, we will get the latest version of ionic and cordova run

[sudo] npm install -g cordova ionic

Once this is done, we will add ios/android platform support. If you are facing issues, please refer PhoneGap 3 CLI Setup on Mac & Windows.

Run from inside bucketListApp folder

ionic platform add ios  or  ionic platform add android

You should see

Screen Shot 2014-07-27 at 1.42.57 pm

And you should see a new platforms folder added with ios/android folder inside it.

Screen Shot 2014-07-27 at 1.44.49 pmNow, we will build the project

ionic build ios  or  ionic build android

You will see a few logs rolling and then you should see that the build is successful. Now, finally to the run app execute

ionic run ios  or  ionic run android

And you should see the emulator launch and the output would be like

Screen Shot 2014-07-27 at 1.47.12 pmYou can sign in and test if you want. Once you are happy with output, we will generate the installer.

As of today, below are the options which can be used along with the package  command.

Screen Shot 2014-07-27 at 1.49.41 pm

To generate an installer, you can run

ionic package debug android

You will need to register (if not done yet) and provide your Ionic credentials to access the service.

This will upload the source code to Ionic service and generate an installer. Once this process is completed, you will receive an email

Screen Shot 2014-07-27 at 1.58.27 pmAnd you can see the installer location in your terminal/prompt

Screen Shot 2014-07-27 at 2.00.04 pmYou can install and test the app on your device.

You can also create installers in release mode. This will generate app store ready installer, which you can directly upload to the app store.

Simple and Sweet right?


Thanks for reading! Do comment.
@arvindr21