7
\$\begingroup\$

I made a game with Unity but the size of .apk file got so large, it is about 70mb... Is there some way that I can compress my apk file?

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Your primary options to get under the 50MB limit for the Google Play Store is 1) move a bunch of your content to Asset Bundles (a Pro-only feature) or 2) split the binary into multiple packages docs.unity3d.com/Manual/android-OBBsupport.html \$\endgroup\$
    – jhocking
    Jun 14, 2014 at 22:58
  • \$\begingroup\$ or 3 optimize your game. using the C++ memory profiler also helps finding how assets unpack in memory and finding the proper compression setting could also reduce file size. \$\endgroup\$
    – Sidar
    May 7, 2018 at 13:22

5 Answers 5

6
\$\begingroup\$

You can compress certain assets individually.

After building the project, go into the log file and there will be a summary of what assets were packaged with the apk, and their sizes. (On windows, located in C:/Users/username/AppData/Local/Unity/Editor/Editor.log)

Find large textures/music/sound, and select them in the project view to bring them in the inspector.

For each texture, there are multiple options: Reduce the 'max size'/'max resolution' (default max resolution is 1024^2, reducing this will force unity to resize the texture upon building the project) Change the compression (Avoid setting textures to TrueColor except where needed)

For music/sound, make sure the format is "Compressed", and then you can adjust the compression value. Compression of ~80kbps is normally good enough to cut the size down, and still mantain decent quality. You can go lower if you really want to. If the 'force to mono' checkbox is enabled, check it. It will reduce the footprint of the file by combining the sounds from the left and right channels.

Be sure to test the game with the assets compressed, and make sure things still look 'good'. You will lose quality by using lossy compression such as reducing resolution or using highly compressed texture formats.

\$\endgroup\$
1
  • \$\begingroup\$ Make sure that you don't choose a texture compression format that fits your assets! ETC1 doesn't support alpha, for example. \$\endgroup\$
    – Mokosha
    Aug 14, 2014 at 23:17
2
\$\begingroup\$
  1. You can use Tinypng to decrease you graphics size without visible graphics quality damage, Decreasing graphics size ultimatly leads to decrease in apk size.
  2. Make spritessheets either using Texture Packer or using Unity3d own Sprites Packer.
  3. (Optional ) if you are targeting only ARMv7 or x86 Devices then change it from player Settings it will reduce approximately 8 to 10 MB.

Edit > Project Settings > Player

In Other Settings Section You will find Device Filter

\$\endgroup\$
3
  • \$\begingroup\$ Thanks for the link to TinyPNG.com. That is an excellent tool. \$\endgroup\$ Dec 26, 2022 at 2:10
  • \$\begingroup\$ Can I build 2 versions of the APK as follows: one version for ARM7 and another version for x86 ? Then, can I submit both versions to Google Play Store ? \$\endgroup\$ Dec 26, 2022 at 2:12
  • \$\begingroup\$ BTW, do you know any simple way or simple softwares to reduce the MP3 file size ? \$\endgroup\$ Dec 26, 2022 at 2:26
1
\$\begingroup\$

Set your image size square and Set unity suggested pixels.(32, 64, 128, 256, 512, 1024, 2048, 4096, 8192) If your image size is 567x890 pixels then set this image in a 1024x1024 pixels background transparent blank image and save it as a png file.

Then in unity inspector set this image as a sprite and slice it by sprite editor. This process will make your image size reduce minimum 20%.

Example image and changes given below.

Before: resolution 567x890 pixel, size 1.9MB

After: resolution 1024x1024 pixel, size 1.3MB

Result: size 0.6MB reduced, almost 32%.

Image file Link: https://drive.google.com/file/d/0B9zkzr6JdNYlaHhqcDVUSk9KNjA/view

\$\endgroup\$
0
\$\begingroup\$

You can also choose to set the Device filter to Arm7. This will exclude certain devices, but I believe the number is quite small and it does minimize the apk size a bit. (This is located in Player Setting -> Other Settings -> Device Filter). You could try a build and see how much it would reduce it by and decide whether it was worth it.

Some Info on device filter: http://answers.unity3d.com/questions/971648/device-filter-to-arm-7-only.html

\$\endgroup\$
1
  • \$\begingroup\$ Can I build 2 versions of the APK as follows: one version for ARM7 and another version for x86 ? Then, can I submit both versions to Google Play Store ? \$\endgroup\$ Dec 26, 2022 at 2:09
0
\$\begingroup\$

It is also good to set texture / sprite compression format.

Check this website: https://docs.unity3d.com/Manual/class-TextureImporterOverride.html

Most texture compression format needs image in power of 2 resolution (128, 256, 512, 1024, 2048). Resolutions 4096 and 8192 may not work on some android devices.

For example texture with no alpha in 1024x1024 resolution using RGB ETC2 compressions takes about 0,5MB in memory. Image 1280x800 with compression format RGB 16bit takes 2MB

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .