Forum Xamarin.Forms

Best way to get a good startup time / APK size relation (The best I can do is around 10 MB)

celopezcelopez Member ✭✭
edited March 31 in Xamarin.Forms


Open Android Configuration options and select Release:

  1. Check "Generated one package per selected ABI" so instead of a bundle of APK's you will get one APK Per ABI then you can upload each APK to the Play Store individually in one release and of course the user will download (automatically) the APK that match with their phone operating system (this is transparent for the user). You have to upload at least the APKs related to armeabi-v7a and arm64v8a, but please continue reading...

  2. Check "Enable startup tracing" (Profiled AOT), "ProGuard" as code shrinker and in Linking select "SDK Assembly Only"

  3. Now Save and Close the tab...

  4. Now Right Click on Android Project and "Open the folder in the Explorer"

  5. Open the XML file "YOURPROJECT.Android.csproj"

  6. Locate the "BundleAssemblies" tag and change it to "True"... Under Release

  7. Save the file and in Visual Studio Click on Reload but take care of not save the android options from Visual Studio... if you do it the BundleAssemblies will be changed back to "False"

  8. Now click on Run and you will see how the Apk size is around 10 - 11 MB... and the startup time will be acceptable

There is a way to get down the size to around 6 or 7 MB but the startup time is slow (for the average phone in Latin America at least)...

Please if you have some ideas to improve this let me know in the comments...

Sign In or Register to comment.