Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to optimize apk per ABI when using xamarin and visual studio?

I have a xamarin forms solution with visual studio 2019 on mac. I try to publish my apk on google play console but it says that they are Unoptimised APK.

In visual studio, I went to Android project options > Android Build. In release configuration, I checked Generate one package (apk) per select ABI. In the advanced tab, I checked the 4 supported ABI. Then I published and then uploaded 4 apks to google play console.

It doesn't seem to be enough, the website advises me to: - Use the Android App Bundle to automatically optimise for device configurations (Not sure it is supported for xamarin solution) - or manage it yourself with multiple APKs (which I did with no success)

I cannot ignore the warning, the button to go to next step is grayed.

like image 951
Cyril Avatar asked Jun 07 '19 12:06

Cyril


People also ask

How can I improve Xamarin Android build times?

There are also a few general MSBuild settings that are helpful for improving Xamarin.Android build times. 1. DebugType A little known setting in all .csproj files is the “Debug Type” of a .NET project: portable – the cross-platform format that Mono and Xamarin supports.

Can I build an APK that will target a single Abi?

Xamarin. Android This document will discuss how to build an APK that will target a single ABI using Xamarin.Android. In some situations it may be advantageous for an application to have multiple APKs - each APK is signed with the same keystore and shares the same package name but it is compiled for a specific device or Android configuration.

What are Xamarin Android app bundles?

If you haven’t heard about Android App Bundles, Xamarin.Android will soon support App Bundles to provide users with optimized APKs per their device specifications when downloading an app from the Google Play Store or various Android App Stores.

How do I create an APK file in Xamarin?

To create the APK file, right-click the Xamarin.Android project in the Solution Explorer and select Archive... This will open the Archive manager and begin archiving the project, preparing to create the APK file.


2 Answers

Unfortunately Xamarin Android does not yet support App Bundles. They are working on it and will be available soon: https://github.com/xamarin/xamarin-android/issues/2727

The PR for the build task is already merged: https://github.com/xamarin/xamarin-android/pull/3146

if you want to try the preview version you can try this (from the Xamarin team):

you should be able to download a visx from our CI system via the Build Status section of our README.md (see https://github.com/xamarin/xamarin-android#build-status) and then picking a Job and going to the Azure Artifacts page. Or just use this to get the latest stable build https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/lastStableBuild/Azure/

Note that these will be the Open Source bits only. So some things (like fast deployment) won't work. But if you are building a release app that should be ok.

The only thing you can do until the App Bundles support will be released, is to use one APK per ABI and ignore the warning from Google Play

Until all your GRAY CHECKS in Google Play Console (on the left side menu ) become green, you will not be allowed to publish in play console and ignore the warning.

like image 200
GiampaoloGabba Avatar answered Sep 27 '22 22:09

GiampaoloGabba


New in Visual Studio 2019 for windows 16.4 and for Mac 8.4 added support for building android app package aab format

enter image description here

like image 41
Abdullah Tahan Avatar answered Sep 27 '22 22:09

Abdullah Tahan