Skip to content

Android NativeAOT builds failing to build #4904

@LoopedBard3

Description

@LoopedBard3

After getting the rest of the Maui builds up to date and working, we started hitting error : The PrivateSdkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative when building for NativeAOT builds. The full log from the start of trying to build the app is as follows:

$ dotnet new android --output app --force --name NetAndroidDefault
The template "Android Application" was created successfully.
$ popd
$ pushd "D:\a\1\s\performance\CorrelationStaging\payload\performance\src\scenarios\netandroid"
$ dotnet restore D:\a\1\s\performance\CorrelationStaging\payload\performance\src\scenarios\netandroid\app\NetAndroidDefault.csproj --packages D:\a\1\s\performance\artifacts\packages /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 -bl:D:\a\1\s\performance\CorrelationStaging\payload\scenarios_out\netandroid\netandroid.coreclr_NativeAOT.binlog-restore.binlog /p:EnableWindowsTargeting=true
  Determining projects to restore...
  Restored D:\a\1\s\performance\CorrelationStaging\payload\performance\src\scenarios\netandroid\app\NetAndroidDefault.csproj (in 945 ms).
$ popd
$ pushd "D:\a\1\s\performance\CorrelationStaging\payload\performance\src\scenarios\netandroid"
$ dotnet publish D:\a\1\s\performance\CorrelationStaging\payload\performance\src\scenarios\netandroid\app\NetAndroidDefault.csproj --configuration Release /p:NuGetPackageRoot=D:\a\1\s\performance\artifacts\packages\ /p:RestorePackagesPath=D:\a\1\s\performance\artifacts\packages\ /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 --output D:\a\1\s\performance\CorrelationStaging\payload\scenarios_out\netandroid --runtime android-arm64 --framework net10.0-android /p:UseMonoRuntime=false /p:PublishAot=true -bl:D:\a\1\s\performance\CorrelationStaging\payload\scenarios_out\netandroid\netandroid.coreclr_NativeAOT.binlog --self-contained /p:EnableWindowsTargeting=true
  Determining projects to restore...
  Restored D:\a\1\s\performance\CorrelationStaging\payload\performance\src\scenarios\netandroid\app\NetAndroidDefault.csproj (in 4.65 sec).
D:\a\1\s\performance\CorrelationStaging\payload\dotnet\sdk\10.0.100-rc.1.25412.107\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(345,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [D:\a\1\s\performance\CorrelationStaging\payload\performance\src\scenarios\netandroid\app\NetAndroidDefault.csproj]
D:\a\1\s\performance\CorrelationStaging\payload\dotnet\packs\Microsoft.Android.Sdk.Windows\36.0.0-ci.main.267\tools\Xamarin.Android.Common.targets(567,3): warning XA1040: The NativeAOT runtime on Android is an experimental feature and not yet suitable for production use. File issues at: https://github.com/dotnet/android/issues [D:\a\1\s\performance\CorrelationStaging\payload\performance\src\scenarios\netandroid\app\NetAndroidDefault.csproj]
  NetAndroidDefault -> D:\a\1\s\performance\CorrelationStaging\payload\performance\src\scenarios\netandroid\app\bin\Release\net10.0-android\android-arm64\NetAndroidDefault.dll
D:\a\1\s\performance\artifacts\packages\microsoft.dotnet.ilcompiler\10.0.0-rc.1.25412.107\build\Microsoft.NETCore.Native.Publish.targets(70,5): error : The PrivateSdkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative [D:\a\1\s\performance\CorrelationStaging\payload\performance\src\scenarios\netandroid\app\NetAndroidDefault.csproj]
$ popd
[2025/08/13 12:08:55][ERROR] Process exited with status 1
/p:UseMonoRuntime=false;/p:PublishAot=true
Traceback (most recent call last):
 File "D:\a\1\s\performance\CorrelationStaging\payload\performance\src\scenarios\netandroid\pre.py", line 31, in <module>
   precommands.execute([])
   ~~~~~~~~~~~~~~~~~~~^^^^
 File "D:\a\1\s\performance\src\scenarios\shared\precommands.py", line 224, in execute
   self._publish(configuration=self.configuration, runtime_identifier=self.runtime_identifier, framework=self.framework, output=self.output, build_args=build_args)
   ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "D:\a\1\s\performance\src\scenarios\shared\precommands.py", line 347, in _publish
   self.project.publish(configuration,
   ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
                        output or const.PUBDIR,
                        ^^^^^^^^^^^^^^^^^^^^^^^
   ...<5 lines>...
                        *['-bl:%s' % self.binlog] if self.binlog else [],
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                        *build_args)
                        ^^^^^^^^^^^^
 File "D:\a\1\s\performance\scripts\performance\tracer.py", line 90, in wrapper
   return func(*args, **kwargs)
 File "D:\a\1\s\performance\scripts\dotnet.py", line 484, in publish
   RunCommand(cmdline, verbose=verbose).run(
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
       self.working_directory
       ^^^^^^^^^^^^^^^^^^^^^^
   )
   ^
 File "D:\a\1\s\performance\scripts\performance\common.py", line 355, in run
   raise CalledProcessError(
       returncode, quoted_cmdline)
   subprocess.CalledProcessError: Command '$ dotnet publish D:\a\1\s\performance\CorrelationStaging\payload\performance\src\scenarios\netandroid\app\NetAndroidDefault.csproj --configuration Release /p:NuGetPackageRoot=D:\a\1\s\performance\artifacts\packages\ /p:RestorePackagesPath=D:\a\1\s\performance\artifacts\packages\ /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 --output D:\a\1\s\performance\CorrelationStaging\payload\scenarios_out\netandroid --runtime android-arm64 --framework net10.0-android /p:UseMonoRuntime=false /p:PublishAot=true -bl:D:\a\1\s\performance\CorrelationStaging\payload\scenarios_out\netandroid\netandroid.coreclr_NativeAOT.binlog --self-contained /p:EnableWindowsTargeting=true' returned non-zero exit status 1.
D:\a\1\s\performance\eng\performance\PreparePayloadWorkItems.targets(4,5): error MSB3073: The command "py -3 pre.py publish -f net10.0-android -r android-arm64 --self-contained --msbuild="/p:UseMonoRuntime=false;/p:PublishAot=true" --binlog D:\a\1\s\performance\CorrelationStaging\payload\scenarios_out\netandroid\netandroid.coreclr_NativeAOT.binlog -o D:\a\1\s\performance\CorrelationStaging\payload\scenarios_out\netandroid" exited with code 1. [D:\a\1\s\performance\eng\performance\maui_scenarios_android.proj]
[2025/08/13 12:08:55][ERROR] Process exited with status 1
[2025/08/13 12:08:55][ERROR] Command: "$ dotnet msbuild D:\a\1/s/performance/eng/performance/maui_scenarios_android.proj /restore /t:PreparePayloadWorkItems /bl:D:\a\1\s\performance\artifacts\log\x64_main_maui_scenarios_android\PrepareWorkItemPayloads.binlog", exited with status: 1
##[error]Cmd.exe exited with code '1'.

Do you know if there is an update we need to make to our build flow @kotlarmilos?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions