microsoft / dotnet

This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.
https://devblogs.microsoft.com/dotnet/
MIT License
14.43k stars 2.21k forks source link

Cannot add System.Json to an Android .NET 8 project #1436

Closed FANMixco closed 6 months ago

FANMixco commented 6 months ago

I'm trying to add the System.JSON to an Android with .NET 8 project that I'm migrating from Xamarin, and only this library is not being recognized:

image
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net8.0-android</TargetFramework>
    <SupportedOSPlatformVersion>22</SupportedOSPlatformVersion>
    <OutputType>Exe</OutputType>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <ApplicationId>tk.supernovaic.themayanroute</ApplicationId>
    <ApplicationVersion>1</ApplicationVersion>
    <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <JavaMaximumHeapSize>2G</JavaMaximumHeapSize>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <JavaMaximumHeapSize>2G</JavaMaximumHeapSize>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="System.Json" Version="4.7.1" />
    <PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.23" />
    <PackageReference Include="Xamarin.AndroidX.Preference" Version="1.2.1.4" />
    <PackageReference Include="Xamarin.Google.Android.Material" Version="1.10.0.3" />
    <PackageReference Include="Xamarin.AndroidX.Legacy.Support.Core.Utils" Version="1.0.0.23" />
    <PackageReference Include="Xamarin.AndroidX.Browser" Version="1.8.0" />
  </ItemGroup>

Any idea why this is happening?

If this is wrong place, please let me know the right one, I also created a ticket here: https://github.com/dotnet/runtime/issues/101758