Skip to content

Notes on Android NativeAOT Support #44

@LittleCodingFox

Description

@LittleCodingFox
  • Cannot use any Android API from Xamarin
  • Must use net9 instead of net9.0-android
  • Requires the NDK on the Path
  • Must use Library instead of Exe output type

Commandline Invocation sample:

dotnet publish -r linux-bionic-arm64 <SLN> -c Release -o <OUT> -p:DisableUnsupportedError=true -p:PublishAotUsingRuntimePack=true

Sample csproj

    <OutputType>Library</OutputType>
    <TargetFramework>net9.0</TargetFramework>
    <StripSymbols>true</StripSymbols>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <TieredCompilation>false</TieredCompilation>
    <PublishReadyToRun>false</PublishReadyToRun>
    <OptimizationPreference>Speed</OptimizationPreference>
    <IlcOptimizationPreference>Speed</IlcOptimizationPreference>
    <MetadataUpdateSupport>false</MetadataUpdateSupport>
    <DebuggerSupport>false</DebuggerSupport>
    <EventSourceSupport>false</EventSourceSupport>
    <StackTraceSupport>false</StackTraceSupport>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <PublishAot>true</PublishAot>
    <EnableTrimAnalyzer>true</EnableTrimAnalyzer>
    <EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
    <EnableAotAnalyzer>true</EnableAotAnalyzer>
    <AndroidEnableMarshalMethods>false</AndroidEnableMarshalMethods>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions