crosswalk in Ionic2 increases app size by 25 MB [duplicate] - ionic-framework

I really hope I'm doing something wrong. I've added crosswalk to a project and have had some serious app size increase. To test I've done the following.
created a new ionic project
added my app code to /www/
added ngcordova and various plugins
Ran ionic build and drop the apk onto a Genymotion emulator. The app was very slow but had a app size of 8.01mb (once installed - checked with app manager).
Then I deleted the app from the emulator
Ran ionic browser add crosswalk
Ran ionic run android which installed the correct .apk on the emulator. On checking in manage apps the app size is now 79.36mb!!! Thats a 71mb increase! Most places say 20mb at most but 71mb!!!
Can someone tell me what I've done wrong?
When I added the Android SDK I did add all the tools ad platforms availabe in the SDK manager, did that have some effect?
If this isn's fixable it's a show stopper for me, which is a shame after spending weeks developing an app...
Please help!

I'm also running into that issue. Unfortunately using crosswalk will definitely increase your apk size. However, I found some way to at least reduce the apk size. For instance you could make use of the crosswalk lite. It may reduce your apk size for about 15 MB (see crosswalk lite).
You can also specify that you don't want to build the projects for two architectures (explained here).

Same problem here. I think promissed size of 20Mb is for the apk file which is compressed, you are looking at installed size on device.
You can check generated APK size on platforms/android/build/outputs/apk/ or platforms/android/ant-build/

I think the problem you're encountering though Crosswalk related, it's emulation related. I've tried emulators from both Android Studio versions and Genymotion. They both didn't work well for hybrid app testing.
My advice is to try Chrome Device Inspector along with actual device testing. I don't think anyone will argue that's the best way to ensure performance. AWS Device Farm is just one of many offerings that will spit out physical devices for testing. There's even services that let you outsource testing on different devices by real people, just can't think of the name of it right now...
My current favorite is Cordova Tools for Visual Studio Code, but it has been buggy for me lately.
However, I'm in the early stages of a fleet of Cordova apps and was alarmed at the overhead Crosswalk has. ~20MB extra to your APKs, and ~70MB to the installed size of your application. That's pretty alarming, considering the apps we use it with, with resource assets (images, etc.) are about 1/10th the size of this one plugin!
We have one app that has actually degraded with Crosswalk. My theory is that Crosswalk doesn't do a good job parsing non-standard HTML which is a core feature we have since we have XSLT transformed XML which winds up being non-standard HTML. Traversing it is extremely slow compared to the default WebView. We do a lot of manipulation with raw DocumentNode objects, so maybe that's it. That said, I'm so surprised that if it's slow traversing/appending HTML via vanilla JavaScript that these other apps are seeing performance gains!
I also learned last night there is Shared Mode with Crosswalk which allows multiple applications that use Crosswalk to share one instance.

Related

Flutter Basics (write once, run anywhere?)

Hi stack overflow community,
I'm a novice programmer in high school and have never written an app for mobile devices before so please bear with me. If I was to write an app using Flutter, will I only be required to write the code once and then be able to distribute different versions of it (iOS, macOS, Windows, Linux, Android, etc)? Or will I need to make small changes for each version such as using XCode to create the iOS version and Android Studio for the Android version? I know this is such a basic question but I've spent a couple of hours looking this stuff up and I'm still confused. Any help would be nice.
Thanks,
Daniel
In a product development environment, after writing the cross-platform code with Flutter, there are some need-to-do tasks related to Native environment.
In the case of Android, there are several cases when you'll need to touch the Native level such as config Firestore settings, Social authentication (Login with Facebook for example), changing the launch icons/ splash screen of the app or publishing to app store, etc
For iOS, the same case apply as well. So I suggest you start with small steps to develop the app first, then when running into something that seems impossible with just Flutter code, there are tutorials and SO to guide you through. It might seem overwhelmed at first, but we are all on a journey, so no need to rush it ;)
You should make small changes too. For eg when adding launcher icons and splash screen you have to edit the respective native folders. When distributing for ios you need to manually customize its Runner from xcode. There are many library that support either android only or ios only. In that case if you need that feature you have to make changes in native code like java ans swift.
if you're creating your own native plugins, you will have unique code to write. But if you're just using things out of pub, almost nothing will require change (unless you are publishing to the store).

Which Flutter default plugins are important?

I am relatively new to flutter and app development. I noticed that whenever a new flutter project is created, there are many default plugins pre-loaded into the project and this makes the app take up a minimum of 80 Mb. Could i get a summary on which plugins are actually important in order to run any app in general?
Flutter provides almost all the basic things like themeing, icons, routing etc out of the box.
You can have any other package if you need more functionality like fetching data from internet and so on.
The important thing is the size you see is the debug build which is large as it contains the VM for hot reload to work at such speed. When you build the release version it is the minimum version which goes for about <5Mb on bare-bone app.
Currently my debug app stands at around 80mb on emulator but the release version is < 6mb.
So to answer your question,
it is the debug size,not the final version
Flutter requires no extra plugin for an offline app with basic functionality. Core components + testing is provided out of the box.
Nothing useless is shipped by default,
NOTE: there is a section called dev_dependencies in pubspec.yaml which means the packages listed under this won't go into the release build and are only for development purpose.

ionic sidemenu on mobile browser not working smoothly

I am developing mobile web app using ionic sidemenu, but it is not as smooth as it should be. When I open sidemenu using slide left/right, I am getting less than 30 FPS as shown in figure.
How can I improve the performance?
Reaching 60 FPS would be great!
AppGyver's Steroids tooling also provides you with access to Crosswalk on Android. You can run it in your Ionic project directly without modifying any files.
Also, Supersonic's sidemenu/drawer is fully native, so if you're up for migrating, it'll run way faster. :)
(Disclaimer: I'm a programmer for AppGyver.)
My advice is to use Crosswalk instead of the Cordova as the webview for the app.
While both share the same end goal, they are different:
Cordova, from the Apache Foundation, uses the regular (pre-lollipop) Android webview, which is based on Android's stock browser since its inception.
The Crosswalk Project, created on the Intel Open Source Technology Center, is different. It wraps your app with Chromium, the open-source base code that gave birth to Google Chrome, which brings numerous performance enhancements: css3 transitions, animations, 3d transformations, html5 support, remote debugging and much better javascript support and performance.
At the time of writing, the Ionic team is already working on a beta version (1.3.0-beta1) that uses Crosswalk instead of Cordova. Not really stable just yet, but a huge promise.
In any case, you can use Crosswalk today, by manually copying your Ionic project's 'www'
folder content to the project folder inside Crosswalk folder and run it. You'll need to setup some manifest files previously, so read the docs.
In any case, it's not hard at all to try, and I'll recommend it everyday for all projects pre-Lollipop. If you're targeting Lollipop/Android 5 versions, you don't need it, because the default Webview in these versions is already Chrome-based.
Hope it helps.

intel xdk really slow, including the demo

I've been creating a game for the last few weeks and everything seemed to be fine on the emulator. But when I tried testing and building it for my Android device (Sony Xperia Z), it was very slow. I tried one of the demo applications they gave with the XDK (Rolling Can) and this one was very slow as well.
I'm wandering if everything I did was for nothing, or that there is a reason for this problem. Can someone help?
The emulator in the Intel XDK is an implementation of the Ripple Cordova emulator. It is running in a desktop browser that is based on the Chromium project. Thus, it has substantially more resources (especially CPU and RAM) to draw upon than your phone or tablet does.
Likewise, your HTML5 app runs inside what is commonly referred to as a "webview," which is kind of like an embedded browser. Some features in this webview are disabled by the OEM firmware, it varies, there is no hard rules.
To address the wide variance in webview performance and HTML5 features that you find on Android devices The XDK also provides a build option based on the Crosswalk open source project. When you build your app using the Crosswalk build option you'll get consistent features and, generally, much better performance on your Android device. (This is only available for Android 4.x devices.) This comes at the cost of adding about 15MB to your application size, because a complete embedded browser is included with the application.
Give the Crosswalk build a try and see if that provides the results you need.
As of February, 2017, the Crosswalk Project has been retired. Crosswalk 23 was the last version of the Crosswalk library produced by the Crosswalk team. You can continue to build for the Crosswalk library using Cordova CLI or PhoneGap Build, but no further updates to the Crosswalk library will occur beyond version 23 (FYI: the Crosswalk 23 library for Android is based on the Chromium 53 runtime release).
If you are only distributing your mobile apps on Android 5 and greater there is no compelling reason for including Crosswalk as part of your app. The Android 5+ webviews are regularly updated, via the Android store, to include an up-to-date copy of the Chrome webview, providing good performance and current features.

Would it be possible to speed up Android Emulator by removing unnecessary apps?

I am using Android SDK 1.6 and developing some simple apps. It seems everytime Android Emulator loads every default apps, like message music browser etc... I guess this cause the booting process slow (takes 1 minute overhead for me to test the code every time).
Would it be possible to take these apps out and just have my apps on the emulator? My purpose is to have a faster boot up time on emulator.
emulator -help
there are a few things you can disable.
Why you would want to disable stuff instead of having a more accurate representation of how it will actually behave on the real device, I don't know.