Xamarin Android - Program type already present: com.google.common.util.concurrent.ListenableFutur

Viewed 556

I am developing a native Android application using Xamarin and Visual Studio. When I try to add the Xamarin.AndroidX.Browser package via Nuget, I get the error "R8 : error : Program type already present: com.google.common.util.concurrent.ListenableFuture" which means that there is a dependency issue.

In the .nuget folder I saw the packages xamarin.google.guava and xamarin.google.guava.listenablefuture which are probably conflicting. After some searching I came across a solution using Gradle, but I don't think this is possible for projects in Visual Studio. How can I solve this dependency issue?

Program type already present: com.google.common.util.concurrent.ListenableFuture

1 Answers

You can try to add the following PackageReference to the .csproj file of your android project:

 <PackageReference Include="Xamarin.Google.Guava.ListenableFuture" ExcludeAssets="build;buildTransitive">
   <Version>1.0.0.2</Version>
 </PackageReference>

See this github comment for more information.

Related