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

Type androidx.lifecycle.ClassesInfoCache$CallbackInfo is defined multiple times #747

Closed
MushKPN opened this issue Jun 22, 2023 · 12 comments
Closed

Comments

@MushKPN
Copy link

MushKPN commented Jun 22, 2023

Android application type

Android for .NET (net6.0-android, etc.)

Affected platform version

VS2022 MAUI .Net 7

Description

Visual Studio 2022 Enterprise 17.6.4 - Xamarin.Android SDK 13.2.0.6 (d17-5/a200af1)

My project targets net7.0-android. When trying to compile my new MAUI project, I've got the following issue :
Type androidx.lifecycle.ClassesInfoCache$CallbackInfo is defined multiple times

Here is my .csproj package configuration :

<ItemGroup>
  <PackageReference Include="CommunityToolkit.Maui" />
  <PackageReference Include="CommunityToolkit.Maui.Core" />
  <PackageReference Include="CommunityToolkit.Maui.Markup" />
  <PackageReference Include="GoogleApi" />
  <PackageReference Include="Microsoft.Extensions.Logging.Debug" />
  <PackageReference Include="Telerik.UI.for.Maui" />
  <PackageReference Include="Xamarin.AndroidX.Activity" />
  <PackageReference Include="Xamarin.AndroidX.Activity.Ktx" />
  <PackageReference Include="Xamarin.AndroidX.Annotation" />
  <PackageReference Include="Xamarin.AndroidX.Lifecycle.Common" />
</ItemGroup>

On my solution, I'm also using central package management, here is my Directory.Packages.props

<Project>
  <PropertyGroup>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
  </PropertyGroup>
  <ItemGroup>
    <PackageVersion Include="ClosedXML" Version="0.101.0" />
    <PackageVersion Include="ColorHelper" Version="1.8.1" />
    <PackageVersion Include="CommandLineParser" Version="2.9.1" />
    <PackageVersion Include="CommunityToolkit.Maui" Version="5.2.0" />
    <PackageVersion Include="CommunityToolkit.Maui.Core" Version="5.2.0" />
    <PackageVersion Include="CommunityToolkit.Maui.Markup" Version="3.2.0" />
    <PackageVersion Include="CsvHelper" Version="30.0.1" />
    <PackageVersion Include="EFCore.BulkExtensions" Version="7.1.2" />
    <PackageVersion Include="FluentMigrator" Version="3.3.2" />
    <PackageVersion Include="FluentMigrator.Runner" Version="3.3.2" />
    <PackageVersion Include="FluentMigrator.Runner.SQLite" Version="3.3.2" />
    <PackageVersion Include="FluentValidation" Version="11.5.2" />
    <PackageVersion Include="GoogleApi" Version="5.0.3" />
    <PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
    <PackageVersion Include="Microsoft.Data.SqlClient" Version="5.1.1" />
    <PackageVersion Include="Microsoft.Data.Sqlite.Core" Version="7.0.7" />
    <PackageVersion Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302" />
    <PackageVersion Include="Microsoft.EntityFrameworkCore" Version="7.0.7" />
    <PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.7" />
    <PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.7" />
    <PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.7" />
    <PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.7" />
    <PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.7" />
    <PackageVersion Include="Microsoft.Extensions.Configuration" Version="7.0.0" Condition="'$(UseMaui)' != 'true'" />
    <PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
    <PackageVersion Include="Microsoft.Extensions.Configuration.FileExtensions" Version="7.0.0" />
    <PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
    <PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" Condition="'$(UseMaui)' != 'true'" />
    <PackageVersion Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
    <PackageVersion Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
    <PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
    <PackageVersion Include="Microsoft.Windows.Compatibility" Version="7.0.3" />
    <PackageVersion Include="NPOI" Version="2.6.0" />
    <PackageVersion Include="Scrutor" Version="4.2.2" />
    <PackageVersion Include="Serilog" Version="3.0.1" />
    <PackageVersion Include="Serilog.Formatting.Compact" Version="1.1.0" />
    <PackageVersion Include="Serilog.Formatting.Compact.Reader" Version="2.0.0" />
    <PackageVersion Include="Serilog.Sinks.Console" Version="4.1.0" />
    <PackageVersion Include="Serilog.Sinks.File" Version="5.0.0" />
    <PackageVersion Include="Serilog.Sinks.Seq" Version="5.2.2" />
    <PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
    <PackageVersion Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
    <PackageVersion Include="System.Data.DataSetExtensions" Version="4.5.0" />
    <PackageVersion Include="System.Drawing.Common" Version="7.0.0" />
    <PackageVersion Include="System.IO.Ports" Version="7.0.0" />
    <PackageVersion Include="System.Resources.ResourceManager" Version="4.3.0" />
    <PackageVersion Include="System.Text.Json" Version="7.0.3" />
    <PackageVersion Include="Telerik.UI.for.Maui" Version="5.2.0" />
    <PackageVersion Include="Ude.NET" Version="1.0.0" />
    <PackageVersion Include="UI.for.WinForms.AllControls.Net70" Version="2023.2.606" />
    <PackageVersion Include="UniversalTypeConverter" Version="2.6.0" />
    <PackageVersion Include="Xamarin.AndroidX.Activity" Version="1.7.2" />
    <PackageVersion Include="Xamarin.AndroidX.Activity.Ktx" Version="1.7.2" />
    <PackageVersion Include="Xamarin.AndroidX.Annotation" Version="1.6.0.3" />
    <PackageVersion Include="Xamarin.AndroidX.Lifecycle.Common" Version="2.6.1.2" />
    <PackageVersion Include="Xamarin.AndroidX.Lifecycle.Common.Java8" Version="2.6.1.2" />
    <PackageVersion Include="Xamarin.AndroidX.Lifecycle.Runtime" Version="2.6.1.2" />
  </ItemGroup>
</Project>

I'm pretty much new to MAUI development, so please let me know if there's something more I can add in order to help investigating this issue

Steps to Reproduce

Add a new MAUI application project (limited to Android .Net 7)
Try adding packages with Directory.Packages.props
Try compiling

Did you find any workaround?

Not yet

Relevant log output

Gravité	Code	Description	Projet	Fichier	Ligne	État de la suppression
Erreur	JAVA0000	Error in C:\Users\cmac\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1.2\buildTransitive\net6.0-android31.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/ClassesInfoCache$CallbackInfo.class:
Type androidx.lifecycle.ClassesInfoCache$CallbackInfo is defined multiple times: C:\Users\cmac\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1.2\buildTransitive\net6.0-android31.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/ClassesInfoCache$CallbackInfo.class, obj\Debug\net7.0-android\lp\178\jl\libs\3B37ECD78F45FD73.jar:androidx/lifecycle/ClassesInfoCache$CallbackInfo.class
Compilation failed
java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\cmac\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1.2\buildTransitive\net6.0-android31.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar
androidx/lifecycle/ClassesInfoCache$CallbackInfo.class
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:98)
	at com.android.tools.r8.D8.main(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:4)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\cmac\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1.2\buildTransitive\net6.0-android31.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/ClassesInfoCache$CallbackInfo.class
	at Version.fakeStackEntry(Version_3.3.75.java:0)
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:75)
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:28)
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:27)
	at com.android.tools.r8.internal.Fj.b(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:2)
	at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:22)
	at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:17)
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:85)
	... 1 more
Caused by: com.android.tools.r8.internal.f: Type androidx.lifecycle.ClassesInfoCache$CallbackInfo is defined multiple times: C:\Users\cmac\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1.2\buildTransitive\net6.0-android31.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/ClassesInfoCache$CallbackInfo.class, obj\Debug\net7.0-android\lp\178\jl\libs\3B37ECD78F45FD73.jar:androidx/lifecycle/ClassesInfoCache$CallbackInfo.class
	at com.android.tools.r8.internal.JT.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:14)
	at com.android.tools.r8.internal.JT.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:22)
	at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:33)
	at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:10)
	at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
	at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:6)
	at com.android.tools.r8.graph.B2$a.e(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:4)
	at com.android.tools.r8.dex.b.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:110)
	at com.android.tools.r8.dex.b.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:28)
	at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:25)
	at com.android.tools.r8.D8.d(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:606)
	at com.android.tools.r8.D8.c(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:1)
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:24)
	... 5 more
Directory 'obj\Debug\net7.0-android\lp\178' is from 'NDC.Utils.aar'.	NDC.Mobile		1
@MushKPN
Copy link
Author

MushKPN commented Jun 22, 2023

Also, my MAUI project (NDC.Mobile) references another .NET 7 library project (NDC.Utils) which has the following .csproj :

<TargetFrameworks>net7.0-android</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.17763.0</TargetFrameworks>
<OutputType>Library</OutputType>

@moljac
Copy link
Contributor

moljac commented Jun 23, 2023

@MushKPN

Thanks for the feedback. Please try updating to the latest packages AndroidX and GPS-FB-MLKit

@moljac
Copy link
Contributor

moljac commented Jun 23, 2023

Please add those 2 dependencies:

		<PackageReference Include="Xamarin.AndroidX.Activity" Version="1.7.2" />
		<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.7.2" />

And please report if this works.

@MushKPN
Copy link
Author

MushKPN commented Jun 23, 2023

Thank you for your reply, can you elaborate a bit more on which package I should install/update ? (as there are many Xamarin.AndroidX. packages)

@MushKPN
Copy link
Author

MushKPN commented Jun 23, 2023

Please add those 2 dependencies:

		<PackageReference Include="Xamarin.AndroidX.Activity" Version="1.7.2" />
		<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.7.2" />

And please report if this works.

Alos, when trying to add the specific version on these two packages, my compilation breaks with error NU1008 (Projects that use central package version management should not define the version on the PackageReference items but on the PackageVersion items: PackageId.) Adding Condition="'$(UseMaui)' != 'true'" in Directory.Packages.props for these two doesn't seem to help :(

@MushKPN
Copy link
Author

MushKPN commented Jun 23, 2023

In order to pinpoint the culprit, I disabled central package management for my MAUI project.

Here is my csproj configuration :

	<ItemGroup>
		<PackageReference Include="CommunityToolkit.Maui" Version="5.2.0" />
		<PackageReference Include="CommunityToolkit.Maui.Core" Version="5.2.0" />
		<PackageReference Include="CommunityToolkit.Maui.Markup" Version="3.2.0" />
		<PackageReference Include="GoogleApi" Version="5.0.3" />
		<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
		<PackageReference Include="Telerik.UI.for.Maui" Version="5.2.0" />
		<PackageReference Include="Xamarin.AndroidX.Activity" Version="1.7.2" />
		<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.7.2" />
		<PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.6.0.3" />
		<PackageReference Include="Xamarin.AndroidX.Lifecycle.Common" Version="2.6.1.2" />
	</ItemGroup>

I'm getting the following (slightly different from before) :

Gravité	Code	Description	Projet	Fichier	Ligne	État de la suppression
Erreur	JAVA0000	Error in C:\Users\cmac\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1.2\buildTransitive\net6.0-android31.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/ClassesInfoCache$MethodReference.class:
Type androidx.lifecycle.ClassesInfoCache$MethodReference is defined multiple times: C:\Users\cmac\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1.2\buildTransitive\net6.0-android31.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/ClassesInfoCache$MethodReference.class, obj\Debug\net7.0-android\lp\178\jl\libs\3B37ECD78F45FD73.jar:androidx/lifecycle/ClassesInfoCache$MethodReference.class
Compilation failed
java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\cmac\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1.2\buildTransitive\net6.0-android31.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar
androidx/lifecycle/ClassesInfoCache$MethodReference.class
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:98)
	at com.android.tools.r8.D8.main(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:4)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\cmac\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1.2\buildTransitive\net6.0-android31.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/ClassesInfoCache$MethodReference.class
	at Version.fakeStackEntry(Version_3.3.75.java:0)
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:75)
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:28)
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:27)
	at com.android.tools.r8.internal.Fj.b(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:2)
	at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:22)
	at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:17)
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:85)
	... 1 more
Caused by: com.android.tools.r8.internal.f: Type androidx.lifecycle.ClassesInfoCache$MethodReference is defined multiple times: C:\Users\cmac\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1.2\buildTransitive\net6.0-android31.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/ClassesInfoCache$MethodReference.class, obj\Debug\net7.0-android\lp\178\jl\libs\3B37ECD78F45FD73.jar:androidx/lifecycle/ClassesInfoCache$MethodReference.class
	at com.android.tools.r8.internal.JT.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:14)
	at com.android.tools.r8.internal.JT.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:22)
	at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:33)
	at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:10)
	at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
	at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:6)
	at com.android.tools.r8.graph.B2$a.e(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:4)
	at com.android.tools.r8.dex.b.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:110)
	at com.android.tools.r8.dex.b.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:28)
	at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:25)
	at com.android.tools.r8.D8.d(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:606)
	at com.android.tools.r8.D8.c(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:1)
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:24)
	... 5 more
Directory 'obj\Debug\net7.0-android\lp\178' is from 'NDC.Utils.aar'.	NDC.Mobile		1	

@moljac
Copy link
Contributor

moljac commented Jun 25, 2023

	<ItemGroup>
		<PackageReference Include="CommunityToolkit.Maui" Version="5.2.0" />
		<PackageReference Include="CommunityToolkit.Maui.Core" Version="5.2.0" />
		<PackageReference Include="CommunityToolkit.Maui.Markup" Version="3.2.0" />
		<PackageReference Include="GoogleApi" Version="5.0.3" />
		<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
		<PackageReference Include="Telerik.UI.for.Maui" Version="5.2.0" />
		<PackageReference Include="Xamarin.AndroidX.Activity" Version="1.7.2" />
		<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.7.2" />
		<PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.6.0.3" />
		<PackageReference Include="Xamarin.AndroidX.Lifecycle.Common" Version="2.6.1.2" />
	</ItemGroup>

Those look good

		<PackageReference Include="Xamarin.AndroidX.Activity" Version="1.7.2" />
		<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.7.2" />
		<PackageReference Include="Xamarin.AndroidX.Annotation" Version="1.6.0.3" />
		<PackageReference Include="Xamarin.AndroidX.Lifecycle.Common" Version="2.6.1.2" />

Now 3rd party - possible problems

  • CommunityToolkit.Maui*

    no AndroidX dependencies

  • GoogleApi

    no AndroidX dependencies

  • Telerik.UI.for.Maui

    no info

  • NDC.Utils.aar NDC.Mobile

    ???

    no info

@MushKPN
Copy link
Author

MushKPN commented Jun 26, 2023

Also, my MAUI project (NDC.Mobile) references another .NET 7 library project (NDC.Utils) which has the following .csproj :

<TargetFrameworks>net7.0-android</TargetFrameworks>
	<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.17763.0</TargetFrameworks>
   <OutputType>Library</OutputType>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
	<LangVersion>Latest</LangVersion>
	<Nullable>disable</Nullable>

And no package reference related in any way to Android

@MushKPN
Copy link
Author

MushKPN commented Jun 26, 2023

After removing this reference, my issue has gone away. It seems impossible to use reference a .Net 7 library project inside a MAUI project

@MushKPN
Copy link
Author

MushKPN commented Jun 26, 2023

I finally figured it out : my NDC.Utils project I was referencing was incorrectly configured.

Here is the simplification I found :

<PropertyGroup>
    <TargetFrameworks>net7.0</TargetFrameworks>
    <OutputType>Library</OutputType>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
	<LangVersion>Latest</LangVersion>
	<Nullable>disable</Nullable>
  </PropertyGroup>

Adding a target to net7.0-android was apparently adding duplicated references, hence my problem.

Thank you for your time.

@moljac
Copy link
Contributor

moljac commented Jun 26, 2023

Thank you for your time.

This is why we are here.

closing this issue

@moljac
Copy link
Contributor

moljac commented Jul 9, 2023

Duplicates:

#717
#742
#747
#749

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants