如何降低封装尺寸 [英] How to reduce the package size

查看:144
本文介绍了如何降低封装尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现了使用Xamarin的Andr​​oid应用程序:

I have implemented an Android application using Xamarin:

该.apk文件的大小是 13.6MB

The size of the .apk is 13.6MB with:

  • 配置:发布
  • 链接:SDK组件仅
  • 支载架构:armeabi,armeabi-V7A
  • Configuration: Release
  • Linking: Sdk Assemblies Only
  • Suported architectures: armeabi,armeabi-v7a

下面是从编译的apk采取的主要部件的尺寸的概览

Here is the overview of sizes of the main components taken from the compiled .apk:

(这是在 uncom pressed 尺寸,我未归档的.apk文件到一个目录,并展望了文件的 Windows资源管理器):

(these are the uncompressed sizes, I unarchived the .apk to a directory and looked to the files in Windows Explorer):

  • classes.dex (1.23 KB)
  • 两个libmonodroid.iso(armeabi + armeabi-V7A)(5.58 MB)
  • 所有Mono.xxx.dll (3.89 MB)
  • mscorlib.dll中(1.51 MB)
  • 所有System.xxx.dll (2.56 MB)

  • classes.dex (1.23 KB)
  • the two libmonodroid.iso (armeabi + armeabi-v7a) (5.58 MB)
  • all Mono.xxx.dll (3.89 MB)
  • mscorlib.dll (1.51 MB)
  • all System.xxx.dll (2.56 MB)

我的应用程序组件(Droid的应用程序加一个PCL)(204 KB)

My app assemblies (the Droid app + one PCL) (204 KB)

PCL微软HTTP客户端库(System.Net.Http.dll)(110KB)

资源文件夹(大小:451KB磁盘大小:816KB) - 因为有些文件是1KB它们产生的碎片,所以的实际尺寸的VS 磁盘大小的是显著不同

'res' folder (Size: 451KB Size on disk: 816KB) - because some files are 1KB they produce fragmentation, so Actual size vs Size on disk is significantly different

我能做些什么,以减少编译.apk文件的大小?

What can I do in order to reduce the size of the compiled .apk?

我觉得pretty的大。

I find it pretty big.

推荐答案

使用链接:SDK +用户大会,并通过标记类与preserve属性的艰难过程(见的 http://docs.xamarin.com/guides/ios/advanced_topics/linker/ )。您可以检查哪些类缺少时,在Android日志你的应用程序崩溃。它应该是唯一通过反射或使用IOC动态使用的类。

Use linking: Sdk + User Assemblies, and go through the difficult process of marking classes with the Preserve attribute (see http://docs.xamarin.com/guides/ios/advanced_topics/linker/). You can check which class is missing when your app crashes in the android log. It should be only the classes used dynamically by reflection or using an IoC.

您还可以创建2个独立的包,一个与armeabi只(适用于很老的设备),一个是armeabiv7a,另一个是86(目前您的应用程序只会崩溃在x86 Android设备)。谷歌播放支持具有3个单独的包具有不同的能力(不要忘记更改您的清单文件中每个包的功能)

You can also create 2 separate packages, one with armeabi only (for very old devices), one with armeabiv7a, and one with x86 (currently your app will just crash on x86 android devices). Google play supports having 3 separate packages with different capabilities (don"t forget to change the capabilities in your manifest file for each package)

这篇关于如何降低封装尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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