- Home /
Sprites increase android apk size
So i don't really know much about compression and other stuff when it comes to an apk, but when i built my apk, i saw that the size was 38mb which is rather large considering the project i was working on did not have much stuff. I then decided to test by adding a couple more sprites to the project, totaling around 1mb. When i built the apk this time, the file size increased by 3mb, even though i only added 1mb of sprites.
Can someone explain to me how this works and how i can reduce the apk size?
Answer by kaplica · Sep 13, 2017 at 11:33 AM
@chiragjksol mentioned about compressing size of images before loading them into unity. That is totally pointless. The file can be 30kb as jpg but once it becomes a texture and then sprite in Unity3d, it goes back to it's original size. Unity decompresses the image from it's format and puts it into memory as 500x500x4bytes for example, so higher resolution images will be bigger in size.
You should work on the graphics in a sophisticated editor like Photoshop or Gimp. You can resize the texture once it's in Unity.
You should be optimising your in-game textures using the inspector. Click on a texture, then in the inspector choose and override platforms that you want to compress the image on.
If you want the texture to be smaller size make sure "Generate mip maps " is unticked.
You can select the size of the texture: Keep lowering it down until it starts to look bad in the editor on the desired resolution. If your texture is transparent select RGBA (RGB if not) and then compression PVRTC 2 bits, if it looks bad change to 4 bits.
You can also try enabling the "Strip Engine Code" In player build settings. This should reduce the build size further.
Thanks for the info.
What i wanted to find out though was why adding 1mb of sprites would increase the apk size by more than 1mb
Because the size of the sprite outside unity will be different when imported and built. I explained this in my answer. $$anonymous$$ake them 256 or 512 in size or smaller in the inspector and they will decrease in size... Obviously the quality will be lower too depending on the resolution you are using.
Answer by chiragjksol · Sep 13, 2017 at 10:05 AM
You can compress all of your image here.
and after goto File -> Build Settings -> click on Player Settings - > you can see there other settings, find there Device Filter and select ARMv7 and check your apk size.
Changing it to AR$$anonymous$$v7 reduced the apk size by 10mb which is great.
What i still don't understand is why does adding 1mb worth of resources increase the apk size by more than 1mb?(it increased the size by 3mb in my case)
Your answer
Follow this Question
Related Questions
Android game too heavy after installation! 0 Answers
Android Apk file size very large, unnecessary assets comressed in APK? 1 Answer
File size is far too big!! 8 Answers
What are the cons of using ETC2 on iOS, or across all platforms? 0 Answers
How do I build apk that works on galaxy s8 aspect ratio (18.5/9)? 0 Answers