5

我已经使用 Polymer 组合了一个 Chrome 应用程序,并希望将其安装在 Android 平台上。我已成功按照此处列出的步骤,编译并部署了 SDK:

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

问题是我的 chrome 应用只有 37k,编译后的 SDK 是 37Mb。我还尝试编译了“Hello World”示例并获得了类似的文件大小。

虽然我预计会有一些开销,但这似乎非常高。我假设这是因为 cca 命令行会自动提取您可能需要的所有预期插件,即使我可能使用的插件很少(如果有的话)。

有没有办法减少使用 cca 构建的应用程序的文件大小 - 或者这只是处于早期开发人员预览阶段的限制?

干杯!

4

1 回答 1

4

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. (This is also an approach we are working hard to get in to cordova-android 4.0 to be release later this year).

At the moment, we build a single apk with support for both intel and arm. We will soon split up the build into separate apks for each architecture, and thus cut the apk size overhead by half. We do expect there to be around ~18Mb overhead using this approach for the foreseeable future, though.

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

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. Most polymer apps run dog slow without the Crosswalk webview (since Chrome/36 is first version to run polymer components natively).

Hope that helps you evaluate your options, and hopefully we can cut the apk size asap. Best of luck!

于 2014-07-25T16:03:08.820 回答