I just upgraded my project to 2017.1.1 from 5.6 and my APK file size went from 93 MB to 108 MB. I can bring that back down to 93MB if I use Gradle as my build system but that breaks Google Play integration for me. What is going on here? Obviously I want to keep my APK <100MB for Google Play so this is a huge issue for me.
You can try two things:
- Disassemble your APK file using a free ApkTool (Apktool | Apktool) and see what’s taking space
- Use some kind of a post-build analysis tool from the assetstore
Please post back here on the results, I’m also interested in your case
So I did what you asked and the results are odd,
Gradle Build System APK 96.1 MB Disassembled Folder Size 155.2 MB
Default Build System APK 111.3 MB Disassembled Folder Size 155.3 MB
When I manually compress the Disassembled Default Build folder to goes back down to 98.7 MB (instead of 111.3 MB)
So the issue does not seem to be content but compression? Not sure why or how to solve this. Any help would be appreciated.
Did you change the Compression Method in 2017.1?
LZ4 and LZ4HC can produce larger APKs at a cost of significant startup time improvement. “None”, or it rather should have been “default”, should match the 5.6 numbers.
Gradle build is probably doing things wrong by compressing streaming assets, but it’s another issue we are working on.
As an APK analysis tool, I can recommend the one built-in into Android Studio. Or you could share your APKs and I can take a look.
I did not change the compression method I use ETC. However I am building both out of the same Unity 2017.1 project so the compression should be the same regardless.
Are you saying that the Gradle build should be larger? I need the APK to be <100 MB why would 2017.1 add that much more to the APK. On 5.6 the APK came in at 97.7 MB on the Default Built System. Adding 10% to the Android build is a huge issue for me.
I uploaded the 2 APKs to my google drive
https://drive.google.com/open?id=0B6DvknTUVVtOWmMxVTdOaDJ5bkU
Thanks for your help
Okay so it’s data.unity3d - the LZ4 data archive - which is not compressed in your “normal” APK and is compressed in “gradle” one.
It should be NOT compressed however.
In order to get your size back to the 5.6 values, you would need to disable LZ4 compression. Unfortunately there’s no UI in 17.1 for that, it appears in the later versions:
You would need to build your game using a script. Let me try to find you some data.
Okay so here’s the option you have to consider when building:
You may want to try LZ4HC to see if it fits into 100 Mb. If it does not - disable LZ4 compression completely.
The API itself to build: Unity - Scripting API: BuildPipeline.BuildPlayer
You’ll have to compose the building script yourself though
Thanks for that, maybe I should just update to 2017.2 so I can see the options like in your screenshot.
Well it took 3 tries to upgrade (I ended up deleting the library). However at the end it I got a build out of 2017.2 (using default build engine) that was 95.8 MB which works very well for me. Thank you for all of your help.
@Ogien did you end up selecting “None” as the compression method?