Updating to Xamarin.Android 7.1.0.41 increase apk size

KarrdeKarrde USUniversity ✭✭

My solution contains multiple project libraries. Before update size of one of them was about 100KB. But now lib's size increased to 5MB. It's seems, that linking sdk and user assemblies is not working(I'm not sure). Does anybody face with this issue?

Tagged:

Answers

  • RutgerPoieszRutgerPoiesz USMember

    Got more or less similar results here: from 300KB to 3.5MB for a specific assembly in the APK.

  • MikhailMelnikMikhailMelnik AUMember ✭✭

    Same here

  • LjusnanLjusnan DEMember ✭✭✭

    Same here

  • TobiasSchulz.9796TobiasSchulz.9796 DEMember ✭✭

    Same here

  • rmaciasrmacias USBeta, University ✭✭✭✭✭

    Interesting, I'll have to check my project when I get home. Are you all seeing this on Mac OS X or on Windows?

  • KarrdeKarrde USUniversity ✭✭

    Windows

  • KarrdeKarrde USUniversity ✭✭

    In addition to this - I delete several images from this custom library(about 1 MB), and it decreases size. It's seems, that now apk resources stored both in folder res and inside dll

  • RutgerPoieszRutgerPoiesz USMember

    This looks a lot like this: https://bugzilla.xamarin.com/show_bug.cgi?id=53250

    Only for resources in stead of native .so files. Maybe add your findings to this bug?

  • nevalennynevalenny USMember ✭✭
    edited March 2017

    Same here, downgrading to Xamarin.Android 7.0.2 fixed the problem. Target platform 7.0 maximum though.

  • LjusnanLjusnan DEMember ✭✭✭

    Did anyone file a bug report for this?

  • KarrdeKarrde USUniversity ✭✭
  • LjusnanLjusnan DEMember ✭✭✭

    @Karrde Thank you

  • mattleibowmattleibow ZAXamarin Team Xamurai

    OK world, some good news, I think we managed to find out some areas of where things are going wrong, and are working to fix that ASAP.

    As a workaround, there is a simple change to the linker settings. If the "Link all assemblies" option is selected, the files are properly shrunk.

    As this may not be possible for some assemblies, especially if there is reflection/deserialization, specific assemblies can be ignored using the "Ignore assemblies" text box.

    For example, in this sample if I wish to skip over the "SkiaSharp.Views.Android.dll" assembly, but still link everything else out, I change the linker option to link all, and then enter "SkiaSharp.Views.Android" in the ignore text box. (note: no extension)

    This might also be a good opportunity to check that the final .apk is the smallest it could be, as well as the linker is not stripping any code that you may be referencing. By using the "SDK only" option, all non-system assemblies are excluded in the process and may be contributing to a larger .apk. Rather than enabling the "link all" and then excluding all assemblies, first have a go at seeing that the app can run with the linker on. You may find that the app is considerably smaller - which is always good for users.

  • LjusnanLjusnan DEMember ✭✭✭

    Linking is already set to "Sdk and User Assemblies" and I skip specific assemblies. Still, the APK size increased after updating to Xamarin.Android 7.1.0.41. Downgrading to 7.0.2.37 fixed the problem.

  • TeemuToivanenTeemuToivanen USUniversity ✭✭

    @Ljusnan said:
    Linking is already set to "Sdk and User Assemblies" and I skip specific assemblies. Still, the APK size increased after updating to Xamarin.Android 7.1.0.41. Downgrading to 7.0.2.37 fixed the problem.

    Same, even with "sdk and user assemblies" my .apk increased from 10MB to 11,7MB. Using same settings (sdk only) as before resulted in 12,5MB apk.

    Which installer did you use to downgrade?

  • LjusnanLjusnan DEMember ✭✭✭
    edited April 2017

    @TeemuToivanen said:

    @Ljusnan said:
    Linking is already set to "Sdk and User Assemblies" and I skip specific assemblies. Still, the APK size increased after updating to Xamarin.Android 7.1.0.41. Downgrading to 7.0.2.37 fixed the problem.

    Same, even with "sdk and user assemblies" my .apk increased from 10MB to 11,7MB. Using same settings (sdk only) as before resulted in 12,5MB apk.

    Which installer did you use to downgrade?

    Sorry, I cannot find the link to the installer I used, but you can try this link to the last stable version of Cycle 8: https://store.xamarin.com/account/my/subscription/downloads#cycle8

  • TeemuToivanenTeemuToivanen USUniversity ✭✭

    @mattleibow said:
    OK world, some good news, I think we managed to find out some areas of where things are going wrong, and are working to fix that ASAP.

    Hey, any updates to this?

  • JohnGraumannJohnGraumann USMember ✭✭

    I also looking for a solution to this one. Our app size increased by 30% which is significant.

  • KarrdeKarrde USUniversity ✭✭

    It's seems that in Xamarin 4.5.0.443 issue was fixed. Application size is decreased as earlier

  • JohnGraumannJohnGraumann USMember ✭✭

    I tried the latest release as well and saw similar results. Not sure why the bug isn't marked fixed, but it seems to work for me now.

Sign In or Register to comment.