- Information usually found in AndroidManifest is split into three files.
AndroidManifest.xml
for various options, intent filters providers etc.AssemblyInfo.cs
for the permissions.Main.cs
for the<Application>
properties.
Label
is set in Main.cs to a resource. For Android this ApplicationName resource is located inResources/values/Strings.xml
. Resources.resw in the Shared project is not used for the label on Android.
In order to get better startup performance on Android, this application is bootstrapped using profiled AOT.
This is a special type of compilation that uses a generated file (custom.aprof
) to optimize the AOT compilation.
To generate this file, following the following steps:
- Open a command prompt or terminal against your Android project’s directory that contains the .csproj.
- Ensure only one Android device is attached.
- Execute the following command:
dotnet build -f net8.0-android -t:BuildAndStartAotProfiling
- The dotnet version targetted must match the one specified in the mobile csproj.
- Let your application run until it’s loaded.
- Execute the following command:
dotnet build -f net8.0-android -t:FinishAotProfiling
.- The dotnet version targetted must match the one specified in the mobile csproj.
- Use this configuration in your
.csproj
.
<EnableLLVM>True</EnableLLVM>
<AndroidEnableProfiledAot>True</AndroidEnableProfiledAot>
<AndroidUseDefaultAotProfile>False</AndroidUseDefaultAotProfile>
<PackageReference Include="Mono.AotProfiler.Android" Version="7.0.0" />
<AndroidAotProfile Include="$(MSBuildThisFileDirectory)custom.aprof" />