如何在Unity中减小APK文件的大小? [英] How to reduce the size of an APK file in Unity?

查看:131
本文介绍了如何在Unity中减小APK文件的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Unity 8MB制作的Android应用的最小APK大小是多少?我正在建立一个空项目,但仍获得8MB.有没有办法减小APK大小?

Is the minimum APK size of an Android app made by Unity 8MB? I am building an empty project, but still getting 8MB. Is there a way to reduce the APK size?

推荐答案

用于减小APK大小:

在Unity 5.6.0f3中,我创建了一个简单的"Hello world"程序并构建了一个APK文件,该文件最初占用21.2 MB的空间,但是要减小大小,您必须执行以下步骤:

In Unity 5.6.0f3 I have created a simple "Hello world" program and build an APK file, it consumes 21.2 MB at first but to reduce the size you have to follow these steps:

Unity 5.6.0f3::播放器设置>其他设置>优化> API兼容性级别

Unity 5.6.0f3: Player settings > other settings > optimization > API compatibility level

Unity 2018.3.6f1:播放器设置>其他设置>配置> API兼容级别

Unity 2018.3.6f1: Player Settings > Other Settings > Configuration > API Compatibility Level

.NET 2.0子集.

.NET 2.0 Subset.

为避免浪费内存,Unity还支持.NET 2.0子集API配置文件.这与Mono"MonoTouch"配置文件非常相似,因此"MonoTouch"配置文件的许多限制也适用于Unity的.NET 2.0子集配置文件.Unity的.NET 2.0子集配置文件.

To avoid memory wastage, Unity also supports the .NET 2.0 Subset API profile. This is very similar to the Mono "MonoTouch" profile, so many limitations of the "MonoTouch" profile also apply to Unity's .NET 2.0 Subset profile.Unity's .NET 2.0 Subset profile.

Unity 5.6.0f3::播放器设置>其他设置>设备过滤器> ARMv7

Unity 5.6.0f3: Player settings > other settings > device filter > ARMv7

Unity 2018.3.6f1:播放器设置>其他设置>配置>目标体系结构

Unity 2018.3.6f1: Player Settings > Other Settings > Configuration > Target Architectures

ARM和x86都是处理器体系结构.x86属于英特尔,而ARM被不同的公司使用并被广泛使用,因此无需选择这两种架构.

ARM and x86 are both processor architectures. x86 belongs to Intel while ARM is used by different companies and widely used, so no need to select both architectures.

Unity 5.6.0f3::播放器设置>其他设置>渲染路径>旧版顶点

Unity 5.6.0f3: Player settings > other settings > rendering path > Legacy Vertex

  • Unity 5.6.0f3::播放器设置>其他设置>优化>剥离级别>使用micro mscorlib

    Unity 5.6.0f3: Player settings > other settings > Optimization > Stripping level > Use micro mscorlib

    使用轻量级mscorlib版本会以兼容性有限为代价.

    The Lightweight mscorlib version will be used at expense of limited compatibility.

    大多数游戏没有使用提供的DLL的所有功能.使用此选项,您可以去除未使用的部件,以减小Android设备上内置播放器的大小.

    Most games do not use all the functionality of the provided DLLs. With this option, you can strip out unused parts to reduce the size of the built player on Android devices.


    应用所有这些更改后,它变为10.4 MB.


    After applying all these changes it becomes 10.4 MB.

    为减小IPA大小:

    在Xcode中,您需要设置的标志很少,

    In Xcode, there are few flags you need to set,

    • 构建设置->启用Objective-C异常-是

    • Build Settings-> Enable Objective-C Exception-Yes

    内部设置->启用BitCode-否

    Build Settings-> Enable BitCode-No

    构建设置->压缩PNG文件-否

    Build Settings-> Compress PNG files -No

    这篇关于如何在Unity中减小APK文件的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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