Ionic run android build too slow for Cordova testing on device


#1

I need some features to be tested on the actual Android device, like Cordova auth, barcode scanner, camera, gallery, file transfer and push messages.

Currently in RC1 a new Android build takes 4-10 minutes, what is the correct way of debugging Cordova related features? In the pre RC0 versions a new build only took a minute or so. These long compile times really make debugging quite hard and time consuming.

Is there a way to disable uglify, clean css, maybe AoT etc as well until a production build is needed and time doesn’t matter that much?

An example of my output for ionic run android:

> ionic-app-scripts build
[22:42:50]  ionic-app-scripts 0.0.33
[22:42:50]  build prod started ...
[22:42:50]  clean started ...
[22:42:50]  clean finished in 11 ms
[22:42:50]  copy started ...
[22:42:50]  ngc started ...
[22:42:51]  copy finished in 319 ms
[22:42:51]  lint started ...
[22:42:56]  lint finished in 4.81 s
[22:43:57]  ngc finished in 66.86 s
[22:43:57]  bundle started ...
[22:44:24]  bundle finished in 26.53 s
[22:44:24]  uglifyjs started ...
[22:44:24]  sass started ...
[22:44:35]  sass finished in 11.02 s
[22:44:35]  cleancss started ...
[22:44:55]  uglifyjs finished in 31.36 s
[22:51:51]  cleancss finished in 435.67 s
[22:51:51]  build prod finished in 540.13 s

Anyone else giving up on RC0? Rolling back to Beta 11!
#2

Try to updated ionic-app-scripts to the latest version, may that help?

Mine seems to be faster:

[14:22:39] ionic-app-scripts 0.0.34
[14:22:39] build prod started …
[14:22:39] clean started …
[14:22:39] clean finished in 9 ms
[14:22:39] copy started …
[14:22:39] ngc started …
[14:22:40] copy finished in 750 ms
[14:22:40] lint started …
[14:22:57] lint finished in 16.55 s
[14:23:54] ngc finished in 74.43 s
[14:23:54] bundle started …
[14:24:19] bundle finished in 25.38 s
[14:24:19] uglifyjs started …
[14:24:19] sass started …
[14:24:23] sass finished in 3.85 s
[14:24:23] cleancss started …
[14:24:25] cleancss finished in 1.77 s
[14:24:41] uglifyjs finished in 22.00 s
[14:24:41] build prod finished in 121.84 s


#3

Hi, thanks for your recommendation, still no luck. How large is your app?

You can count the lines of code with:

$ cd src 
$ find . -name '*.ts' | xargs wc -l
$ ionic run android

[15:33:42]  ionic-app-scripts 0.0.34
[15:33:42]  build prod started ...
[15:33:42]  clean started ...
[15:33:42]  clean finished in 8 ms
[15:33:42]  copy started ...
[15:33:42]  ngc started ...
[15:33:42]  copy finished in 277 ms
[15:33:42]  lint started ...
[15:33:47]  lint finished in 4.74 s
[15:34:49]  ngc finished in 66.81 s
[15:34:49]  bundle started ...
[15:35:16]  bundle finished in 27.07 s
[15:35:16]  uglifyjs started ...
[15:35:16]  sass started ...
[15:35:27]  sass finished in 10.75 s
[15:35:27]  cleancss started ...
[15:35:47]  uglifyjs finished in 30.92 s
[15:42:30]  cleancss finished in 423.89 s
[15:42:30]  build prod finished in 528.55 s

For reference: building the tabs template took 50 seconds


#4
14044 total

More or less than you?


#5

I have 6000 lines. Are you sure you did this in your src folder? Since 14k lines is quite a lot :stuck_out_tongue:


#6

Yep pretty sure. I had that feeling too that it was a little bit too much code, now I know why I’m behind schedule :wink:


#7

There is now a new version of the ionic-app-scripts, 0.0.36
With that one my build is like 5sec slower overall


#8

I’ve been playing around with the scss files. Turned out the @import “ionic.theme.default” was imported in both app.scss and variables.scss. Since variables.scss is imported in almost every component I can imagine this causes trouble.

Build times improved a lot now :slight_smile:

> ionic-app-scripts build

[21:20:01]  ionic-app-scripts 0.0.34
[21:20:01]  build prod started ...
[21:20:01]  clean started ...
[21:20:01]  clean finished in 9 ms
[21:20:01]  copy started ...
[21:20:01]  ngc started ...
[21:20:01]  copy finished in 54 ms
[21:20:01]  lint started ...
[21:20:06]  lint finished in 4.33 s
[21:21:06]  ngc finished in 64.78 s
[21:21:06]  bundle started ...
[21:21:31]  bundle finished in 25.65 s
[21:21:31]  uglifyjs started ...
[21:21:31]  sass started ...
[21:21:34]  sass finished in 2.62 s
[21:21:34]  cleancss started ...
[21:21:36]  cleancss finished in 2.41 s
[21:22:02]  uglifyjs finished in 30.81 s
[21:22:02]  build prod finished in 121.28 s

#9

As pointed out in this issue by jgw96 you can even speedup the android device build time:

Hello @basvdijk ! If you would like to do a dev build to your device, which builds alot faster than our prod build (although it does not do any of the optimizations that a prod build does) you can change this line in your package.json to

"build": "ionic-app-scripts build --dev"