Apk size still the same while using generator-ionic


#1

Hi Ionic,
Recently I started exploring generator-ionic ( https://github.com/diegonetto/generator-ionic) for my app.
It kinda cool for getting your code production-ready. However I have a question related to building the app. When I do “grunt serve:compress” , the “www” folder gets generated with minification and concatenation and the size of the folder is almost 3MB less than the original which is super.
However, when I execute “grunt build:android”, the apk size is still around 5-6 MB as the command doesnt do any minification etc.
Is that purposefully done or some bug?

I took a peek at grunt File and found this:

serve command has this: grunt.task.run([‘compress’, ‘ionic:serve’]);
build command has this : grunt.task.run([‘init’, ‘ionic:build:’ + this.args.join()]);

There is no compress task in build command. (i did experiment replavcing init task with compress and apk size went down to ~1.2MB from 5-6 MB and the default tab app just worked fine)

So I am not sure whether this was done on purpose?


#2

You can tailor the build to however you like, so yes you can swap out init for compress in that case, especially since you probably wont be using the build task for much.

I would definitely leave the run, and emulate tasks to use init though so you can take advantage of ionic live reload, and have it execute quickly.


#3

Thanks for the info.

Also facing the same issue mentioned in the below stack overflow post (but not answered yet):

On doing “grunt serve” : “ionic serve” just exists without any error and the ‘watch’ task keeps executing. I have the latest bits.