简体   繁体   English

减少Cordova Chrome应用(cca)APK大小

[英]Reduce Cordova Chrome App (cca) APK Size

I've put together a Chrome App using Polymer and wanted to install it on the Android platform. 我已经组装了一个使用Polymer的Chrome应用,并希望将其安装在Android平台上。 I've successfully followed the steps listed here, compiled and deployed an SDK: 我已成功遵循此处列出的步骤,编译并部署了SDK:

https://github.com/MobileChromeApps/mobile-chrome-apps https://github.com/MobileChromeApps/mobile-chrome-apps

The problem, is that my chrome app is only 37k, and the compiled SDK is 37Mb. 问题是我的chrome应用程序只有37k,编译的SDK为37Mb。 I tried also compiling down the 'Hello World' sample and got a similar file size. 我尝试还编译了“ Hello World”示例,并得到了类似的文件大小。

While I anticipated there would be some overhead this seems remarkably high. 虽然我预计会有一些开销,但这似乎非常高。 I'm assuming it's because the cca command line automatically pulls in all anticipated plugins that you might need, even though I'm probably using very few (if any) of them. 我假设这是因为cca命令行会自动提取您可能需要的所有预期插件,即使我可能很少使用(如果有)。

Is there a way to reduce the file size on apps built with cca - or is this just a limitation while it's in its early developer preview stages? 有没有办法减少使用cca构建的应用程序的文件大小-还是处于开发人员早期预览阶段时的限制?

Cheers! 干杯!

The large size of Chrome Apps for Mobile (using the cca tool) is due to us bundling the Crosswalk WebView automatically, which is currently based on Chrome/36. 由于我们自动捆绑了Crosswalk WebView (目前基于Chrome / 36),因此Chrome Apps for Mobile的体积很大(使用cca工具)。 (This is also an approach we are working hard to get in to cordova-android 4.0 to be release later this year). (这也是我们正在努力进入将于今年晚些时候发布的cordova-android 4.0的一种方法)。

At the moment, we build a single apk with support for both intel and arm. 目前,我们构建了一个既支持英特尔又支持ARM的apk。 We will soon split up the build into separate apks for each architecture, and thus cut the apk size overhead by half. 我们很快将针对每种体系结构将构建拆分为单独的apk,从而将apk大小的开销减少了一半。 We do expect there to be around ~18Mb overhead using this approach for the foreseeable future, though. 但是,在可预见的将来,我们确实希望使用这种方法会有大约18Mb的开销。

If you would really like, you can opt-out of using crosswalk by adding "webview": "system" to your manifest.mobile.json and rebuilding your project ( but there may be a bug here at the moment , see issue for workaround). 如果您确实愿意,可以通过在manifest.mobile.json添加"webview": "system"并重建项目来选择不使用人行横道( 但此刻可能存在错误 ,请参见解决方法) )。

You can read more information from our Release Notes , but we've got on our backlog to write up a whole FAQ about this approach. 您可以从发行说明中阅读更多信息,但我们还有很多积压工作,以撰写有关此方法的完整常见问题解答。

You should know that even on the latest Android KitKat 4.4.3, the system webview will not run Polymer components without polyfills. 您应该知道,即使在最新的Android KitKat 4.4.3上,如果没有polyfill,系统webview也将无法运行Polymer组件。 Most polymer apps run dog slow without the Crosswalk webview (since Chrome/36 is first version to run polymer components natively). 大多数聚合物应用程序在没有Crosswalk Webview的情况下运行起来都很慢(因为Chrome / 36是第一个本地运行聚合物组件的版本)。

Hope that helps you evaluate your options, and hopefully we can cut the apk size asap. 希望能帮助您评估您的选择,并希望我们能尽快削减apk大小。 Best of luck! 祝你好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM