Improving Ionic2 Android Performance

We’re developing a cross platform app for both iOS and Android. So far the iOS version is running fairly smoothly, but the Android version is significantly slower, at time almost unusable.

The main screen is using the ion-slides control with about 15 complex slides, each with scroll areas, lots of custom CSS, with a lot of *ngIf and *ngFor to populate the view with data.

We’re currently using Ionic2@beta11, and specifying android-minSdkVersion 19 with android-targetSdkVersion 23.

Is there anyway to optimize the app for Android? Is using cordova-plugin-crosswalk-webview recommended?

Crosswalk might help. Easy enough to add and test with. :slight_smile: Android varies so much from device to device, that plugin can help level the playing field.

The AOT templates might also be useful once they arrive in the framework.

Thanks Chris for the suggestions.

Crosswalk did in fact help improve performance, especially on older Android devices. Unfortunately it does increase the size of the APK a lot, and also running into some issues with Google Play’s limited support for multiple APKs for Beta Testing, but might be a necessary evil.

Also migrating large pages, into re-usable components seemed to help improve performance a lot, especially *ngFor with lots of items.

Think one of the big bottlenecks was using ion-slides with 15+ complex slides. To help this, I added *ngIf="(slide-1 == index || slide == index || slide+1 == index)" inside each ion-slide. So a maximum of three slides is every loaded at once, the previous, current and next slide. This seemed to make a big difference, and still allowed for swiping preview of next or previous to work as expected.

3 Likes

But crosswalk increase the apk size up to 33MB. and without crosswalk it was only 9 MB.
please help me to reduce the apk size

Sadly Crosswalk does increase your APK. There is Crosswalk Lite, which is a
bit smaller.

Chris