71mb added to app size for crosswalk

2019-01-09 11:17发布

问题:

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.

  1. created a new ionic project
  2. added my app code to /www/
  3. added ngcordova and various plugins
  4. 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).
  5. Then I deleted the app from the emulator
  6. Ran ionic browser add crosswalk
  7. 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!

回答1:

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).



回答2:

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/



回答3:

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.