Abhijeet Raj
Abhijeet Raj

Reputation: 81

Unable to reduce the size of Xamarin forms app while exporting to APK file

I have created a simple application in Xamarin forms, with 5 Tabbed pages, each of which has a WebView in it which calls 5 different websites. Nothing more. Current size of APK is 17 MB.

I tried all the methods available on Google to reduce the size of my app. I don't understand which part I am missing. I have enabled multi-dex,code shrinker, Linking enabled everything mentioned.

I am attaching the screenshot of my settings, APK-analyzer result and the code for my project.

Link to project solution: https://drive.google.com/drive/folders/18i3j6qDzlm4nN6DFHjBPLCW9Ab2WdG08?usp=sharing

Warning getting while uploading to playstore

Android Options settingsBuild options image APK Analyzer resultAdvanced Android Options

Upvotes: 1

Views: 330

Answers (2)

matfillion
matfillion

Reputation: 867

You should enable Application App bundles (.aab). It will reduce your application size even more once deployed through the Google Play store. (And remove this warning on the store submission)

To enable it, look in your *.Droid.csproj properties

csproj options

This xamarin blog post is a good reference.

Upvotes: 0

ottermatic
ottermatic

Reputation: 1012

Select App Bundle instead of APK for Android Package Format in Android Options. Also, check Generate one package per selected ABI create a separate packages for armabi-v7a and one for arm64-v8a.

Edit: rereading that error message sounds like using App Bundle will automatically optimize for separate ABIs which i was not aware of. You might not need to check Generate one package per selected ABI, but it doesn't hurt.

Upvotes: 1

Related Questions