Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[net8-pre5] Build app for android-arm fails with error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.linux-bionic-arm #8170

Open
tranb3r opened this issue Jul 6, 2023 · 13 comments
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects.

Comments

@tranb3r
Copy link

tranb3r commented Jul 6, 2023

Android application type

.NET Android (net7.0-android, etc.)

Affected platform version

net8-pre5

Description

Building my app for android-arm, it fails with the following error:

error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.linux-bionic-arm. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Local, Microsoft Visual Studio Offline Packages, nuget.org

Steps to Reproduce

Check the attached binlog
msbuild.zip

Did you find any workaround?

No response

Relevant log output

No response

@tranb3r tranb3r added Area: App+Library Build Issues when building Library projects or Application projects. needs-triage Issues that need to be assigned. labels Jul 6, 2023
@tranb3r
Copy link
Author

tranb3r commented Jul 6, 2023

Workaround: add this to csproj:

  <Target Name="_RemoveLinuxFrameworkReferences"
      AfterTargets="ProcessFrameworkReferences">
    <ItemGroup>
      <_ProblematicRIDs Include="linux-bionic-arm;linux-bionic-arm64;linux-bionic-x86;linux-bionic-arm64" />
      <PackageDownload Remove="Microsoft.NETCore.App.Runtime.%(_ProblematicRIDs.Identity)" />
    </ItemGroup>
  </Target>

@jonathanpeppers
Copy link
Member

This is very similar to an old problem: #7043

I thought something like this might cause it, but it seems to work fine:

dotnet new android
dotnet add package SQLitePCLRaw.bundle_green --version 2.1.5
dotnet build

If you look at the .binlog above it has:

image

Normally Android apps don't include this package.

@steveisok @dsplaisted was there something we did in dotnet/runtime solve this before?

I heard we may have introduced linux-bionic-* RIDs for experimenting with NativeAOT on Android. Maybe we need the same fix for those?

@steveisok
Copy link
Member

We've had mono based linux-bionic packs around for quite a long time, so it's a bit confusing why nativeaot ones would introduce problems. @akoeplinger do you know of anything in the sdk that might be getting skipped b/c it's not mono and as a result would cause this?

@akoeplinger
Copy link
Member

.NET8 preview 5 was before the linux-bionic NativeAOT changes so that shouldn't be related.

@akoeplinger
Copy link
Member

@tranb3r did this work with an earlier .NET 8 preview, or just .NET 7?

@tranb3r
Copy link
Author

tranb3r commented Jul 7, 2023

I've just tested with .NET 7: it does not work either.

@jonathanpeppers
Copy link
Member

@tranb3r is there a specific NuGet package in your app that triggers this problem? Project templates obviously work fine.

The ones I see are:

<PackageReference Include="ConfigureAwait.Fody" Version="3.3.2" PrivateAssets="All" />
<PackageReference Include="Fody" Version="6.8.0">
	<PrivateAssets>all</PrivateAssets>
	<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.0-preview.5.8529" />
<PackageReference Include="Plugin.Maui.ScreenSecurity" Version="1.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Xamarin" Version="1.0.0" />
<PackageReference Include="Xamarin.Build.Download" Version="0.11.4" />
<PackageReference Include="Xamarin.AndroidX.Work.Runtime" Version="2.8.1.2" />

But there could be other packages from project references.

@akoeplinger
Copy link
Member

I think I know what's going on: the project OuiBank.Core is getting restored with the RuntimeIdentifier=android-arm, but it is targeting net8.0 so the Android SDK is not getting involved, which means we're not setting UseMonoRuntime=true and that in turn means we're getting the normal Microsoft.NETCoreApp.Runtime.**RID** instead of Microsoft.NETCoreApp.Runtime.Mono.**RID** and the former doesn't have a linux-bionic-arm package on nuget.org.

@akoeplinger
Copy link
Member

akoeplinger commented Jul 7, 2023

Here's a simple repro:

$ dotnet new classlib -o myLib
$ cd myLib
$ dotnet restore -r android-arm
  Determining projects to restore...
/Users/alexander/dev/test/8170/myLib/myLib.csproj : error NU1101: Unable to find package Microsoft.NETCore.App.Runtime.linux-bionic-arm. No packages exist with this id in source(s): /usr/local/share/dotnet/library-packs, nuget.org
  Failed to restore /Users/alexander/dev/test/8170/myLib/myLib.csproj (in 514 ms).

The reason why it's using linux-bionic-arm is because the RID graph specifies it as a parent of android-arm. Not sure if the RID flowing to the library project in the original issue project is expected, @dsplaisted ?

@dsplaisted
Copy link
Member

Not sure if the RID flowing to the library project in the original issue project is expected, @dsplaisted ?

I would not expect the RID to flow to the library. Normally the MSBuild project reference protocol is used to (among other things) determine whether a referenced project is "RID agnostic" or not. The default logic is that if a project is not an Exe project and doesn't define RuntimeIdentifier or RuntimeIdentifiers properties, then a global RuntimeIdentifier property won't flow to it.

The project reference protocol doesn't seem to have been used in this binlog. I think maybe it never applied to NuGet's project reference walk, but that didn't cause any issues until now.

@tranb3r
Copy link
Author

tranb3r commented Sep 18, 2023

Any update?

@jpobst jpobst removed the needs-triage Issues that need to be assigned. label Jan 9, 2024
@tranb3r
Copy link
Author

tranb3r commented Feb 20, 2024

Is this going to be fixed?

@amirvenus
Copy link

is android not supported on dotnet 8.0 arm Ubuntu?

dotnet workload search

Workload ID Description

aspire .NET Aspire SDK (Preview)
macos .NET SDK Workload for building macOS applications.
maui-tizen .NET MAUI SDK for Tizen
maui-windows .NET MAUI SDK for Windows
wasi-experimental workloads/wasi-experimental/description
wasm-experimental workloads/wasm-experimental/description
wasm-tools .NET WebAssembly build tools

dotnet workload install android
Workload ID android isn't supported on this platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: App+Library Build Issues when building Library projects or Application projects.
Projects
None yet
Development

No branches or pull requests

8 participants