IBM Worklight - 生成的Android项目的.apk的文件大小 [英] IBM Worklight - Filesize of the generated Android project's .apk

查看:161
本文介绍了IBM Worklight - 生成的Android项目的.apk的文件大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Worklight 6.1 版本上开发app,它包含默认的公共文件夹,该文件夹由worklight自己在创建项目时创建。当我在 Android 环境中测试apk的大小时,它会给出2.2MB。大小应该非常小,因为到目前为止我还没有在项目中添加我的文件。

I am developing app on Worklight 6.1 version and it contains default common folder which is being created by worklight itself while creating the project. As I am testing size of apk for Android environment , it gives 2.2MB. Size should be very small because till now I haven't added my files in the project.

我的问题是为什么在使用worklight创建默认应用时尺寸很大,因为你可以说 Hello Worklight 项目。大小应该是KB。

My question is why the size is big when creating the default app with worklight as you can say Hello Worklight project. Size should be in KB.

因此,请告诉我工作灯是否在构建环境或其他内容时为项目添加任何额外的库。

So let me know whether worklight is adding any extra library for the project while building environment or something else.

推荐答案

如果使用Android环境创建一个新的Worklight项目并为其生成.apk,.apk的重量为2.3MB。

If creating a new Worklight project with the Android environment and generating an .apk for it, the .apk weighs 2.3MB.

如果你解压缩.apk,你会注意到在assets文件夹中,包含Worklight框架的worklight文件夹的重量为1.2MB。如果然后你拿这些1.2MB并仅压缩它们(那么看看.apk里面的框架大小是多少)它会下降到~500Kb,所以在.apk的2.3MB之内,Worklight不占大多数文件大小...

If you uncompress the .apk you will note that inside the assets folder, the worklight folder that houses the Worklight framework weighs at 1.2MB. If you then take these 1.2MB and compresses only them (so to see what is the framework size when inside the .apk) it will drop to ~500Kb, so out of the 2.3MB of the .apk, Worklight does not take the majority of the file size...

现在,最小化文件大小的方法:

Now, ways to minimize the file size some more:


  • 您也许可以转到res文件夹并从您知道在应用程序中不支持的屏幕分辨率文件夹中删除图像文件,但这样可以减少非常少量的文件大小。

  • You can perhaps go to the res folder and remove image files from screen resolution folders that you know you are not going to support in your application, but that will shave a very very small amount of file size.

您可以使用Google的Closure编译器和SIMPLE_OPTIMIZATION选项(不是ADVANCED_OPTIMIZATION,这会破坏并且不受支持)来缩小文件,从而减少大小更多。

You can use Google's Closure compiler with the SIMPLE_OPTIMIZATION option (not ADVANCED_OPTIMIZATION, this will break things and is not supported) to minify the files and thus reduce from the size some more.

以上情况也适用于应用网络资源,而不仅仅是Worklight框架文件。

The above is true also to the app web resources and not just for the Worklight framework files.

您还可以启用Google的Android ProGuard 也有助于减少文件大小。

You can also enable Google's Android ProGuard which helps in reducing file size as well.

这篇关于IBM Worklight - 生成的Android项目的.apk的文件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆