Skip to content Skip to sidebar Skip to footer

Xamarin.forms Android Aot Support

does anyone know how to use AOT compilation instead of JIT for Xamarin.Forms Android project? Im simply unhappy with the boot times of Android app while iOS starts like it should (

Solution 1:

Within the Release configuration PropertyGroup in your Xamarin.Android's .csproj file, add a AotAssemblies element that is set to true, optionally add an EnableLLVM element.

Note: As this will increase the size of your APK, my advice would be to make sure that the Mono Linker is active in your release config ("Link all assemblies" would be ideal to remove as much unused IL are possibly before the AOT process takes place to help minimize the size of each native shared library)

<PropertyGroupCondition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    ~~~
    <AotAssemblies>true</AotAssemblies><EnableLLVM>true</EnableLLVM>
    ~~~
</PropertyGroup>

AotAssemblies – A boolean property that determines whether or not assemblies will be Ahead-of-Time compiled into native code and included in the .apk.

EnableLLVM – A boolean property that determines whether or not LLVM will be used when Ahead-of-Time compiling assemblies into native code.

re: https://docs.microsoft.com/en-us/xamarin/android/deploy-test/building-apps/build-process

Post a Comment for "Xamarin.forms Android Aot Support"