0
\$\begingroup\$

I developed a game, and build it as an Android APK file. I was not using any assets, only a UI panel and a UI Button. I thought the APK file woul be 3 MB, but it was 18MB.

On the Google Play store, there are many good games using good graphics that have a small size. Some are only 5MB or 6MB. I want to know why I am getting such a large APK file.

How do I reduce the size of my APK file?

\$\endgroup\$
3
  • \$\begingroup\$ @Gnemlock thnx lot. Actually my question was "how to reduce the game size?". Is it possible in UNITY? \$\endgroup\$
    – Gopal
    Oct 9, 2016 at 5:02
  • \$\begingroup\$ Again, its impossible to say without pure speculation, without being able to actually see your project, and look at things such as file format. Is there a single button compression? Yes. The build button. So obviously, that in itself is not very useful. \$\endgroup\$
    – Gnemlock
    Oct 9, 2016 at 5:10
  • \$\begingroup\$ @Gopal the apk is a zip file, extract it and see what's inside. My first guess for the biggest one is the unity runtime (often this can be quite large and considering the complexity of unity it could be that ). There are also assets and some other stuff required by android. \$\endgroup\$
    – Raxvan
    Nov 17, 2016 at 17:33

5 Answers 5

1
\$\begingroup\$

When you build APK in Unity then the entire engine code is included as a library, the last time I've checked it was about 9-10MB, but I'm sure it changes between engine and/or Android versions. For this reason you can't get below this size and all your assets are just added on top of it.

Change the extension of your APK to zip and open the file as regular archive to see more details.

\$\endgroup\$
2
  • \$\begingroup\$ thank you for your suggestion. How to I change the extension from .apk to .zip? \$\endgroup\$
    – Gopal
    Nov 18, 2016 at 5:36
  • \$\begingroup\$ Just in Windows Explorer. You need to have "hide file extensions" option disabled, so you're seeing file like "MyGame.APK" instead of "MyGame" then just rename it to "MyGame.zip". \$\endgroup\$
    – kolenda
    Nov 18, 2016 at 10:04
0
\$\begingroup\$

I had a similar problem. Try reducing and compressing the size of the textures. I reduced the size of my assets while ensuring that their quality remains the same .

\$\endgroup\$
1
  • \$\begingroup\$ thnq for ur ans.I did not have any assets and textures.it is empty project.if I m trying to built the APK file it shows 18.5 MB \$\endgroup\$
    – Gopal
    Oct 14, 2016 at 6:41
0
\$\begingroup\$

Unity 5 Android builds seem to be larger than previous versions. That being said, if you look in the build's player settings and use ARMv7 instead of FAT (Armv 7 + x86) the size will be reduced some, but this will also make the app incompatible with mobile devices that use a full x86 processor. Such devices are far less common though.

\$\endgroup\$
1
  • \$\begingroup\$ This post talks about that more. Would be nice if there were statistics on the market share of each instruction set (couldn't find any :/) \$\endgroup\$
    – Cobertos
    Oct 11, 2016 at 17:41
0
\$\begingroup\$

Often textures take up most space in the build. The first to do is to use compressed texture formats (DXT(Desktop platforms) or PVRTC) where you can.

Meshes and imported Animation Clips can be compressed so they take up less space in your game file. Compression can be turned on in the Mesh Import Settings.

When building a player, you should avoid any dependencies on System.dll or System.Xml.dll. Unity does not include these in the built player by default but if you use their classes then they will get included. These DLLs will add about a megabyte to the player’s storage size.

- Unity Manual: Reducing the File Size of a Build

\$\endgroup\$
1
  • 2
    \$\begingroup\$ You may want to link to where you copied the info from for users who would like further reading. \$\endgroup\$
    – Cobertos
    Oct 11, 2016 at 10:46
0
\$\begingroup\$

ProGuard

A tool for code shrinking, like ProGuard, will significantly reduce the static foot print. Note that it is very important to re-test all of the application after applying ProGuard since it may change the application behavior.

As ProGuard replaces the application symbols, to make the code difficult to read, it is important that you retain the symbol mapping, so that you can translate a stack trace back to the original symbols if you have to investigate a crash in your application.

- Answer submitted by GrisHu to "Does including JAR in android projects affect the size of the APK" at Stack Overflow.

\$\endgroup\$
2
  • \$\begingroup\$ thnq @Raevat but what i need to do reduce the game size in unity? \$\endgroup\$
    – Gopal
    Oct 9, 2016 at 5:05
  • \$\begingroup\$ @Gopal, the user would not know. Both their answers are simple copy pastes from other answers. \$\endgroup\$
    – Gnemlock
    Jan 20, 2017 at 23:18

You must log in to answer this question.

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