Search Unity

2017.1.1 Upgrade APK Size Increase + 15MB

Discussion in 'Android' started by Ogien, Oct 8, 2017.

  1. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    165
    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.
     
  2. Kumo-Kairo

    Kumo-Kairo

    Joined:
    Sep 2, 2013
    Posts:
    343
    You can try two things:
    1. Disassemble your APK file using a free ApkTool (https://ibotpeaches.github.io/Apktool/) and see what's taking space
    2. 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
     
  3. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    165
    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.
     
  4. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    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.
     
  5. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    165
    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
     
    Last edited: Oct 11, 2017
  6. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    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:

    upload_2017-10-13_12-2-16.png

    You would need to build your game using a script. Let me try to find you some data.
     
  7. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
  8. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    165
    Thanks for that, maybe I should just update to 2017.2 so I can see the options like in your screenshot.
     
  9. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    165
    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.
     
  10. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @Ogien did you end up selecting "None" as the compression method?