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?
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.
- You can use Tinypng to decrease you graphics size without visible graphics quality damage, Decreasing graphics size ultimatly leads to decrease in apk size.
- Make spritessheets either using Texture Packer or using Unity3d own Sprites Packer.
- (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
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
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
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