GooglePlayServicesComponents icon indicating copy to clipboard operation
GooglePlayServicesComponents copied to clipboard

MSBuild\Xamarin\Android\Xamarin.Android.D8.targets(79,5): error MSB6006: "java.exe" exited with code 1.

Open Mataboge opened this issue 4 years ago • 50 comments

Xamarin.Android Version (eg: 6.0):

Android 10

Operating System & Version (eg: Mac OSX 10.11):

Windows 10, visual studio 19 16.7.2

Google Play Services Version

Xamarin.Firebase.Firestore v121.4.3-preview02 also tried (71.1705.4)

Describe your Issue

Immediately after adding this package, I get the build error MSB6006: "java.exe" exited with code 1. Which points to the Xamarin.Android.D8.targets(79,5) file and line 79 is the beginning D8 compiler code.

Edit:

after some investigation, i found that the issue is caused by having these packages at the same time: <PackageReference Include="Xamarin.GooglePlayServices.Ads"> <Version>119.1.0-preview02</Version> </PackageReference> and

<PackageReference Include="Xamarin.Firebase.Firestore"> <Version>121.4.3-preview02</Version> </PackageReference> These two packages seem to be referencing different versions on Xamarin.GoogleplayServices.Base and that causes this error. I am forced to use that Xamarin.GooglePlayServices.Ads version because other versions cause this error ( #369 ). Any other version of Xamarin.Firebase.Firestore isn't working well

Relevant information

Add relevant project settings from *.csproj file:

Packages used:

    <PackageReference Include="Acr.UserDialogs">
      <Version>7.1.0.446</Version>
    </PackageReference>
    <PackageReference Include="IntelliAbb.Xamarin.Controls">
      <Version>1.0.148</Version>
    </PackageReference>
    <PackageReference Include="PCLStorage">
      <Version>1.0.2</Version>
    </PackageReference>
    <PackageReference Include="Plugin.InAppBilling">
      <Version>2.0.0</Version>
    </PackageReference>
    <PackageReference Include="Plugin.LocalNotification">
      <Version>5.0.6</Version>
    </PackageReference>
    <PackageReference Include="Plugin.Permissions">
      <Version>6.0.1</Version>
    </PackageReference>
    <PackageReference Include="sqlite-net-pcl">
      <Version>1.7.335</Version>
    </PackageReference>
    <PackageReference Include="Xam.Plugin.LatestVersion">
      <Version>1.1.2</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.Fragment">
      <Version>1.2.4.2</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.Fragment">
      <Version>1.2.4.2</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.Migration">
      <Version>1.0.6.2</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Essentials">
      <Version>1.5.3.2</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Firebase.Firestore">
      <Version>121.4.3-preview02</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Forms">
      <Version>4.8.0.1269</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.GooglePlayServices.Ads">
      <Version>119.1.0-preview02</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.Migration" Version="1.0.0-preview03" />

Build settings (tools)

    <AndroidDexTool>d8</AndroidDexTool>

Steps to Reproduce (with link to sample solution if possible):

install these two packages in the project then build & deploy. <PackageReference Include="Xamarin.GooglePlayServices.Ads"> <Version>119.1.0-preview02</Version> </PackageReference> and <PackageReference Include="Xamarin.Firebase.Firestore"> <Version>121.4.3-preview02</Version> </PackageReference>

Include any relevant Exception Stack traces, build logs, adb logs:

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.D8.targets(79,5): error MSB6006: "java.exe" exited with code 1.

Mataboge avatar Aug 26 '20 14:08 Mataboge

My Analysis of the problems seems to have been wrong at the beginning, the issue seems to have been caused by the Firebase.Firestore Plugin and the 'Plugin.LocalNotifications', removal of any of these two plug-ins the error goes away.

Mataboge avatar Sep 24 '20 16:09 Mataboge

Can you attach diagnosic logs, please?

moljac avatar Sep 27 '20 22:09 moljac

build.log

Mataboge avatar Sep 27 '20 22:09 Mataboge

Can I see your project file, please? OR at least ProjectReferences?

moljac avatar Sep 28 '20 04:09 moljac

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{A75388B3-D512-4365-85E4-AB8EAC5C9E73}</ProjectGuid>
    <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <TemplateGuid>{6968b3a4-1835-46a3-ac5c-1ae33b475983}</TemplateGuid>
    <OutputType>Library</OutputType>
    <RootNamespace>SampleProject.Droid</RootNamespace>
    <AssemblyName>SampleProject.Android</AssemblyName>
    <Deterministic>True</Deterministic>
    <AndroidApplication>True</AndroidApplication>
    <AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
    <AndroidResgenClass>Resource</AndroidResgenClass>
    <AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
    <MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
    <MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
    <AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
    <TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
    <AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
    <AndroidUseAapt2>true</AndroidUseAapt2>
    <AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>portable</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug</OutputPath>
    <DefineConstants>DEBUG;</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AndroidLinkMode>None</AndroidLinkMode>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>portable</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AndroidManagedSymbols>true</AndroidManagedSymbols>
    <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Mono.Android" />
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Numerics" />
    <Reference Include="System.Numerics.Vectors" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Plugin.LocalNotification">
      <Version>5.0.7</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Firebase.Ads.Lite">
      <Version>71.1601.4</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Firebase.Firestore">
      <Version>71.1705.4</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Forms" Version="4.8.0.1451" />
    <PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="MainActivity.cs" />
    <Compile Include="Resources\Resource.designer.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\AboutResources.txt" />
    <None Include="Assets\AboutAssets.txt" />
    <None Include="Properties\AndroidManifest.xml" />
  </ItemGroup>
  <ItemGroup>
    <AndroidResource Include="Resources\layout\Tabbar.xml" />
    <AndroidResource Include="Resources\layout\Toolbar.xml" />
    <AndroidResource Include="Resources\values\styles.xml" />
    <AndroidResource Include="Resources\values\colors.xml" />
    <AndroidResource Include="Resources\mipmap-anydpi-v26\icon.xml" />
    <AndroidResource Include="Resources\mipmap-anydpi-v26\icon_round.xml" />
    <AndroidResource Include="Resources\mipmap-hdpi\icon.png" />
    <AndroidResource Include="Resources\mipmap-hdpi\launcher_foreground.png" />
    <AndroidResource Include="Resources\mipmap-mdpi\icon.png" />
    <AndroidResource Include="Resources\mipmap-mdpi\launcher_foreground.png" />
    <AndroidResource Include="Resources\mipmap-xhdpi\icon.png" />
    <AndroidResource Include="Resources\mipmap-xhdpi\launcher_foreground.png" />
    <AndroidResource Include="Resources\mipmap-xxhdpi\icon.png" />
    <AndroidResource Include="Resources\mipmap-xxhdpi\launcher_foreground.png" />
    <AndroidResource Include="Resources\mipmap-xxxhdpi\icon.png" />
    <AndroidResource Include="Resources\mipmap-xxxhdpi\launcher_foreground.png" />
    <AndroidResource Include="Resources\drawable\xamarin_logo.png" />
    <AndroidResource Include="Resources\drawable\tab_about.png" />
    <AndroidResource Include="Resources\drawable\tab_feed.png" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\SampleProject\SampleProject.csproj">
      <Project>{4256123D-5731-43DC-9F48-B820EE9E35C6}</Project>
      <Name>SampleProject</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>

Mataboge avatar Sep 28 '20 08:09 Mataboge

I have the same issue, found by installing the same components (Xamarin.Firebase.Firestore and Plugin.LocalNotification). I did some further tests and can conclude that there's some incompatibility between Xamarin.Firebase.Firestore (or a dependency) and Xamarin.AndroidX.Work.Runtime. There seems to be no version combination of the two that works. Is there any new info available about this?

EDIT: It is easily reproducible by installing VS Enterprise 2019 16.7.4, creating a new Xamarin.Forms project, installing e.g. Xamarin.Firebase.Firestore 120.2.0 and Xamarin.AndroidX.Work.Runtime 2.3.4.6 into the Android project, and trying to build the project/solution.

REXiator avatar Oct 14 '20 16:10 REXiator

Could you provide binlogs please. Those are smaller and easier to investigate. Thanks

moljac avatar Oct 14 '20 19:10 moljac

Sure. Here is a binlog of the sample scenario I described (plus targeted Android to API level 30 and removed iOS project so as not to flood the logs with Mac connection attempts): msbuild.zip

REXiator avatar Oct 15 '20 13:10 REXiator

I get the same error but using different libraries. When I tried upgrading all Firebase libraries i get the issue.

When I looked through the msbuild command output I saw this:

Error in obj\Debug\100\lp\140\jl\classes.jar:com/google/android/gms/internal/measurement/zzu.class:
  Type com.google.android.gms.internal.measurement.zzu is defined multiple times: obj\Debug\100\lp\140\jl\classes.jar:c
  om/google/android/gms/internal/measurement/zzu.class, obj\Debug\100\lp\160\jl\classes.jar:com/google/android/gms/inte
  rnal/measurement/zzu.class
  Compilation failed

Also switching from d8 to dx compiler produces this error after waiting over 30 minutes for the build to complete:

CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/MSFTSIG.SF] (Duplicate jar entry [META-INF/MSFTSIG.SF])
CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [META-INF/MSFTSIG.RSA] (Duplicate jar entry [META-INF/MSFTSIG.RSA])
CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [firebase-analytics-impl.properties] (Duplicate jar entry [firebase-analytics-impl.properties])
CREATEMULTIDEXMAINDEXCLASSLIST : warning : can't write resource [firebase-measurement-connector-impl.properties] (Duplicate jar entry [firebase-measurement-connector-impl.properties])
  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/measurement/AppMeasurement;
  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/measurement/AppMeasurementContentProvider;
  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/measurement/AppMeasurementInstallReferrerReceiver;
  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/measurement/zzsi;
  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/measurement/AppMeasurement;
  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/measurement/AppMeasurementContentProvider;
  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/measurement/AppMeasurementInstallReferrerReceiver;
  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/measurement/zzu;
  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/measurement/zzv;
  
  UNEXPECTED TOP-LEVEL EXCEPTION:
  java.lang.RuntimeException: Translation has been interrupted
  	at com.android.dx.command.dexer.Main.processAllFiles(Main.java:614)
  	at com.android.dx.command.dexer.Main.runMultiDex(Main.java:365)
  	at com.android.dx.command.dexer.Main.runDx(Main.java:286)
  	at com.android.dx.command.dexer.Main.main(Main.java:244)
  	at com.android.dx.command.Main.main(Main.java:95)
  Caused by: java.lang.InterruptedException: Too many errors
  	at com.android.dx.command.dexer.Main.processAllFiles(Main.java:606)
  	... 4 more
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\Android\Xamarin.Android.DX.targets(83,5): error : java.lang.IllegalArgumentException: already added :  Lcom/google/android/gms/measurement/AppMeasurement;

hvaughan3 avatar Oct 25 '20 20:10 hvaughan3

@moljac, @jpobst, since I was looking at another conflicting Java type issue today (https://github.com/xamarin/xamarin-android/issues/5237), I was curious if this was related and took a quick look at this too. This case looks like something a little different.

Example error message for reference:

Type com.google.common.util.concurrent.ListenableFuture is defined multiple times: C:\Users\user\.nu
get\packages\xamarin.google.guava.listenablefuture\1.0.0.2\buildTransitive\monoandroid50\guava-liste
nablefuture.jar:com/google/common/util/concurrent/ListenableFuture.class, obj\Release\100\lp\47\jl\_
_reference__guava.jar:com/google/common/util/concurrent/ListenableFuture.class

Investigation notes:

I noticed that according to https://mvnrepository.com/artifact/com.google.firebase/firebase-firestore/21.4.3, Xamarin.Firebase.Firestore version 121.4.3 might not need the dependency that it currently has on Xamarin.Google.Guava.

I can stop the build error with the following steps:

  1. Add the following PackageReference for Xamarin.Google.Guava with ExcludeAssets="all":

    <PackageReference Include="Xamarin.Google.Guava" ExcludeAssets="all">
      <Version>27.1.0</Version>
    </PackageReference>
    
  2. Delete the obj\project.assets.json file and close and reopen the solution to force the NuGet packages to re-restore.

That is, if I intentionally exclude the assets from the Xamarin.Google.Guava package so the __reference__guava.jar isn't extracted or used at all during the build, the build is successful. Admittedly, I haven't tested the behavior of Xamarin.Firebase.Firestore at run time on device with this work around.

But if this sounds right, then maybe the Xamarin.Google.Guava dependency can be removed from the latest versions of the Xamarin.Firebase.Firestore NuGet package?

brendanzagaeski avatar Oct 26 '20 23:10 brendanzagaeski

Hello everyone, I have a similar problem and tried everything. Here's my detailed log:

5>Usando la tarea "D8" del ensamblado "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll". 5>Tarea "D8" 5> processing ClassesZip, JavaLibrariesToEmbed... 5> C:\Program Files\Java\jdk1.8.0_271\bin\java.exe -Xmx1G -classpath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\r8.jar" com.android.tools.r8.D8 --debug --min-api 22 --output obj\Debug\110\android\bin\ --lib "C:\Program Files (x86)\Android\android-sdk\platforms\android-30\android.jar" --lib "C:\Program Files (x86)\Android\android-sdk\platforms\android-30\optional\org.apache.http.legacy.jar" obj\Debug\110\android\bin\classes.zip "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v11.0\mono.android.jar" "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\\java_runtime.jar" C:\Users\chave\.nuget\packages\xamarin.androidx.annotation\1.1.0.6\buildTransitive\monoandroid90\..\..\jar\androidx.annotation.annotation.jar C:\Users\chave\.nuget\packages\xamarin.androidx.collection\1.1.0.5\buildTransitive\monoandroid90\..\..\jar\androidx.collection.collection.jar C:\Users\chave\.nuget\packages\xamarin.androidx.lifecycle.common\2.2.0.3\buildTransitive\monoandroid90\..\..\jar\androidx.lifecycle.lifecycle-common.jar C:\Users\chave\.nuget\packages\xamarin.androidx.arch.core.common\2.1.0.6\buildTransitive\monoandroid90\..\..\jar\androidx.arch.core.core-common.jar C:\Users\chave\.nuget\packages\xamarin.androidx.room.common\2.2.5.5\buildTransitive\monoandroid90\..\..\jar\androidx.room.room-common.jar C:\Users\chave\.nuget\packages\xamarin.androidx.paging.common\2.1.2.5\buildTransitive\monoandroid90\..\..\jar\androidx.paging.paging-common.jar obj\Debug\110\androidx\jl\56b8ca90-8e8e-4903-a49f-eaea4ea0a53c.jar obj\Debug\110\lp\100\jl\bin\classes.jar obj\Debug\110\lp\101\jl\bin\classes.jar obj\Debug\110\lp\107\jl\bin\classes.jar obj\Debug\110\lp\108\jl\bin\classes.jar obj\Debug\110\lp\109\jl\bin\classes.jar obj\Debug\110\lp\111\jl\auto-value-annotations.jar obj\Debug\110\lp\112\jl\dagger.jar obj\Debug\110\lp\114\jl\bin\classes.jar obj\Debug\110\lp\115\jl\bin\classes.jar obj\Debug\110\lp\116\jl\bin\classes.jar obj\Debug\110\lp\117\jl\bin\classes.jar obj\Debug\110\lp\118\jl\bin\classes.jar obj\Debug\110\lp\119\jl\bin\classes.jar obj\Debug\110\lp\120\jl\bin\classes.jar obj\Debug\110\lp\121\jl\bin\classes.jar obj\Debug\110\lp\122\jl\bin\classes.jar obj\Debug\110\lp\123\jl\bin\classes.jar obj\Debug\110\lp\124\jl\bin\classes.jar obj\Debug\110\lp\125\jl\bin\classes.jar obj\Debug\110\lp\126\jl\bin\classes.jar obj\Debug\110\lp\127\jl\bin\classes.jar obj\Debug\110\lp\128\jl\bin\classes.jar obj\Debug\110\lp\129\jl\bin\classes.jar obj\Debug\110\lp\13\jl\formsviewgroup.jar obj\Debug\110\lp\130\jl\bin\classes.jar obj\Debug\110\lp\131\jl\bin\classes.jar obj\Debug\110\lp\132\jl\bin\classes.jar obj\Debug\110\lp\133\jl\bin\classes.jar obj\Debug\110\lp\134\jl\bin\classes.jar obj\Debug\110\lp\135\jl\javax-inject.jar obj\Debug\110\lp\136\jl\protobuf-lite-3.0.1.jar obj\Debug\110\lp\140\jl\classes.jar obj\Debug\110\lp\141\jl\classes.jar obj\Debug\110\lp\142\jl\classes.jar obj\Debug\110\lp\143\jl\classes.jar obj\Debug\110\lp\144\jl\classes.jar obj\Debug\110\lp\145\jl\classes.jar obj\Debug\110\lp\146\jl\classes.jar obj\Debug\110\lp\147\jl\classes.jar obj\Debug\110\lp\148\jl\classes.jar obj\Debug\110\lp\149\jl\classes.jar obj\Debug\110\lp\15\jl\bin\classes.jar obj\Debug\110\lp\150\jl\classes.jar obj\Debug\110\lp\151\jl\classes.jar obj\Debug\110\lp\152\jl\classes.jar obj\Debug\110\lp\153\jl\classes.jar obj\Debug\110\lp\154\jl\classes.jar obj\Debug\110\lp\155\jl\classes.jar obj\Debug\110\lp\156\jl\classes.jar obj\Debug\110\lp\157\jl\classes.jar obj\Debug\110\lp\158\jl\classes.jar obj\Debug\110\lp\159\jl\classes.jar obj\Debug\110\lp\160\jl\classes.jar obj\Debug\110\lp\161\jl\classes.jar obj\Debug\110\lp\162\jl\classes.jar obj\Debug\110\lp\163\jl\classes.jar obj\Debug\110\lp\164\jl\classes.jar obj\Debug\110\lp\165\jl\classes.jar obj\Debug\110\lp\166\jl\classes.jar obj\Debug\110\lp\167\jl\classes.jar obj\Debug\110\lp\168\jl\classes.jar obj\Debug\110\lp\169\jl\classes.jar obj\Debug\110\lp\170\jl\classes.jar obj\Debug\110\lp\171\jl\classes.jar obj\Debug\110\lp\172\jl\classes.jar obj\Debug\110\lp\173\jl\classes.jar obj\Debug\110\lp\174\jl\classes.jar obj\Debug\110\lp\176\jl\classes.jar obj\Debug\110\lp\177\jl\classes.jar obj\Debug\110\lp\178\jl\classes.jar obj\Debug\110\lp\179\jl\classes.jar obj\Debug\110\lp\180\jl\classes.jar obj\Debug\110\lp\181\jl\classes.jar obj\Debug\110\lp\182\jl\classes.jar obj\Debug\110\lp\183\jl\classes.jar obj\Debug\110\lp\184\jl\classes.jar obj\Debug\110\lp\196\jl\classes.jar obj\Debug\110\lp\197\jl\classes.jar obj\Debug\110\lp\198\jl\classes.jar obj\Debug\110\lp\199\jl\classes.jar obj\Debug\110\lp\200\jl\classes.jar obj\Debug\110\lp\201\jl\classes.jar obj\Debug\110\lp\208\jl\classes.jar obj\Debug\110\lp\209\jl\classes.jar obj\Debug\110\lp\211\jl\classes.jar obj\Debug\110\lp\214\jl\classes.jar obj\Debug\110\lp\215\jl\classes.jar obj\Debug\110\lp\3\jl\bin\classes.jar obj\Debug\110\lp\32\jl\okio.jar obj\Debug\110\lp\4\jl\bin\classes.jar obj\Debug\110\lp\5\jl\bin\classes.jar obj\Debug\110\lp\6\jl\bin\classes.jar obj\Debug\110\lp\7\jl\bin\classes.jar obj\Debug\110\lp\8\jl\bin\classes.jar obj\Debug\110\lp\9\jl\bin\classes.jar obj\Debug\110\lp\93\jl\bin\classes.jar 5> Error in obj\Debug\110\lp\211\jl\classes.jar:com/google/android/gms/internal/crash/zza.class: 5> Type com.google.android.gms.internal.crash.zza is defined multiple times: obj\Debug\110\lp\211\jl\classes.jar:com/google/android/gms/internal/crash/zza.class, obj\Debug\110\lp\93\jl\bin\classes.jar:com/google/android/gms/internal/crash/zza.class 5> Compilation failed

And here is my PackageReferences:

<PackageReference Include="BarcodeScanner.XF">
  <Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="CardsView">
  <Version>2.6.6</Version>
</PackageReference>
<PackageReference Include="Com.Airbnb.Xamarin.Forms.Lottie">
  <Version>4.0.6</Version>
</PackageReference>
<PackageReference Include="ContextViewCell">
  <Version>2.0.1</Version>
</PackageReference>
<PackageReference Include="Plugin.LocalNotification">
  <Version>5.1.0</Version>
</PackageReference>
<PackageReference Include="Plugin.MediaManager.Forms">
  <Version>1.0.4</Version>
</PackageReference>
<PackageReference Include="Rg.Plugins.Popup">
  <Version>2.0.0.6</Version>
</PackageReference>
<PackageReference Include="Sharpnado.Presentation.Forms">
  <Version>1.7.1</Version>
</PackageReference>
<PackageReference Include="System.Runtime.Extensions">
  <Version>4.3.1</Version>
</PackageReference>
<PackageReference Include="TouchView">
  <Version>4.1.89</Version>
</PackageReference>
<PackageReference Include="Xam.Plugin.DeviceInfo">
  <Version>4.1.1</Version>
</PackageReference>
<PackageReference Include="Xam.Plugin.HtmlLabel">
  <Version>4.1.3</Version>
</PackageReference>
<PackageReference Include="Xam.Plugin.Media">
  <Version>5.0.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Arch.Core.Common">
  <Version>1.1.1.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Arch.Core.Runtime">
  <Version>1.1.1.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Arch.Lifecycle.Common">
  <Version>1.1.1.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Arch.Lifecycle.Extensions">
  <Version>1.1.1.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Arch.Lifecycle.LiveData">
  <Version>1.1.1.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Arch.Lifecycle.LiveData.Core">
  <Version>1.1.1.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Arch.Lifecycle.Runtime">
  <Version>1.1.1.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Arch.Lifecycle.ViewModel">
  <Version>1.1.1.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Annotations">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Collections">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Compat">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Core.UI">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.CursorAdapter">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Fragment">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Interpolator">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Loader">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Media.Compat">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.v4">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.v7.RecyclerView">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.VersionedParcelable">
  <Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.AppCompat">
  <Version>1.2.0.4</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.AppCompat.AppCompatResources">
  <Version>1.2.0.4</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.AppCompat.Resources">
  <Version>1.1.0.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Browser">
  <Version>1.2.0.2</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Collection">
  <Version>1.1.0.5</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Core">
  <Version>1.3.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4">
  <Version>1.0.0.5</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Service">
  <Version>2.2.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Media">
  <Version>1.1.0.5</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.MediaRouter">
  <Version>1.1.0.5</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Migration">
  <Version>1.0.7.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Paging.Common">
  <Version>2.1.2.5</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Paging.Runtime">
  <Version>2.1.2.5</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Palette">
  <Version>1.0.0.5</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.RecyclerView">
  <Version>1.1.0.5</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Room.Runtime">
  <Version>2.2.5.5</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.VersionedParcelable">
  <Version>1.1.1.5</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Work.Runtime">
  <Version>2.3.4.6</Version>
</PackageReference>
<PackageReference Include="Xamarin.Build.Download">
  <Version>0.10.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.FFImageLoading.Forms">
  <Version>2.4.11.982</Version>
</PackageReference>
<PackageReference Include="Xamarin.FFImageLoading.Transformations">
  <Version>2.4.11.982</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.CardView" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.v7.MediaRouter" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Android.Support.CustomTabs" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
<PackageReference Include="Xamarin.Firebase.Abt">
  <Version>119.0.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Analytics">
  <Version>117.4.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Common">
  <Version>119.3.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Components">
  <Version>116.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Config">
  <Version>119.1.4</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Core">
  <Version>117.4.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Crash">
  <Version>116.2.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Datatransport">
  <Version>117.0.5</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Encoders.JSON">
  <Version>116.1.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Iid">
  <Version>120.1.7</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Installations">
  <Version>116.3.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Installations.InterOp">
  <Version>116.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Measurement.Connector">
  <Version>118.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Messaging">
  <Version>120.1.7</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms">
  <Version>4.8.0.1560</Version>
</PackageReference>
<PackageReference Include="Xamarin.Forms.Visual.Material">
  <Version>4.8.0.1560</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.Android.DataTransport.TransportApi">
  <Version>2.2.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.Android.DataTransport.TransportBackendCct">
  <Version>2.2.2</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.Android.DataTransport.TransportRuntime">
  <Version>2.2.2</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.Android.Material">
  <Version>1.0.0.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.Dagger">
  <Version>2.25.2.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Base">
  <Version>117.2.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Basement">
  <Version>117.2.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Flags">
  <Version>117.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Gcm">
  <Version>117.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Location">
  <Version>117.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Maps">
  <Version>117.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Measurement">
  <Version>117.4.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Measurement.Api">
  <Version>117.4.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Measurement.Sdk">
  <Version>117.4.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Tasks">
  <Version>117.0.2</Version>
</PackageReference>
<PackageReference Include="Xamarin.JavaX.Inject">
  <Version>1.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Plugin.SharedTransitions">
  <Version>2.4.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.Protobuf.Lite">
  <Version>3.0.1</Version>
</PackageReference>
<PackageReference Include="XamEffects">
  <Version>1.6.3</Version>
</PackageReference>
<PackageReference Include="XF.Material">
  <Version>1.7.5</Version>
</PackageReference>

felipechavez avatar Oct 30 '20 15:10 felipechavez

@felipechavez, that looks similar to https://github.com/xamarin/xamarin-android/issues/5237, but involving a different type, so I suspect it might be caused by a different outdated NuGet package. I tried a quick experiment with copying and pasting the list of PackageReference elements into a new project, but unfortunately I wasn't able to reproduce the error that way.

An idea for a next step is that you can try the "Manual investigation approach" from https://github.com/xamarin/xamarin-android/issues/5237#issuecomment-716895315 to identify which two NuGet packages are causing the conflict and see if one looks outdated. If that doesn't reveal a way to solve the problem by updating or removing an old NuGet package, then if you can submit a new issue with all the details you've collected so the team can take a look, that would be perfect. Thanks in advance!

brendanzagaeski avatar Oct 30 '20 17:10 brendanzagaeski

@brendanzagaeski thanks very much for the answer, i figured it out uninstalling Xamarin.Firebase.Crash v116.2.1 in the android projects (what an irony). Works fine now after cleaning bin/obj and compiling (action that triggered the error before)

felipechavez avatar Oct 31 '20 18:10 felipechavez

Excellent. Glad you found a solution, and thanks for sharing the information on how you solved it!

brendanzagaeski avatar Nov 02 '20 01:11 brendanzagaeski

@felipechavez Did you solve the problem by removing Xamarin.Firebase.Crash? In my project I only have Xamarin.Firebase.Firestore and Xamarin.Firebase.Auth. I am looking for a solution to this problem (Error MSB6006: “java” exited with code 1) for more than a week but no solution. :(

PT-BR Você resolveu o problema removendo o Xamarin.Firebase.Crash? No meu projeto eu só tenho o Xamarin.Firebase.Firestore e Xamarin.Firebase.Auth. Estou procurando uma solução para esse problema (Error MSB6006: “java” exited with code 1 ) a mais de uma semana mas nada de uma solução. :(

EduardoReisDev avatar Nov 07 '20 17:11 EduardoReisDev

image

EduardoReisDev avatar Nov 07 '20 17:11 EduardoReisDev

Candidate workaround

@EduardoReisDev, thanks for the information. If you're using Xamarin.Firebase.Firestore and you haven't yet resolved the issue, I think the workaround from https://github.com/xamarin/GooglePlayServicesComponents/issues/379#issuecomment-716884242 might work in your case too. In particular:

  1. Open the .csproj project file for the Xamarin.Android app project in Visual Studio or another text editor.

  2. Find the <PropertyGroup> tag that contains the <PackageReference> elements for the project, and add the following additional <PackageReference> element to that list:

    <PackageReference Include="Xamarin.Google.Guava" ExcludeAssets="all">
      <Version>27.1.0</Version>
    </PackageReference>
    
  3. Delete the obj\project.assets.json file and close and reopen the solution to force the NuGet packages to re-restore.

brendanzagaeski avatar Nov 19 '20 15:11 brendanzagaeski

Alternative candidate workaround

Install Xamarin.Google.Guava version 27.1.0.2 or higher into the Xamarin.Android app project.

Explanation: Starting with version 27.1.0.2, Xamarin.Google.Guava no longer supplies any Java libraries to the build process when it is referenced from app projects, so it no longer causes the conflict. (This is technically a little unexpected, but for the purposes of this particular conflict issue with Firestore, it is convenient because it provides a workaround.)

brendanzagaeski avatar Nov 19 '20 16:11 brendanzagaeski

@brendanzagaeski

OMG! It worked! I followed the steps you told me in the first comment. I added the PackageReference to the .csproj file.

Thank you!!

EduardoReisDev avatar Nov 20 '20 13:11 EduardoReisDev

Perfect. Glad it worked for you too!

brendanzagaeski avatar Nov 20 '20 17:11 brendanzagaeski

@brendanzagaeski your solutions seem to make this error go away, but eventually, guava introduces this runtime error

Java.Lang.NoClassDefFoundError: 'Failed resolution of: Lcom/google/common/io/BaseEncoding;

do you perhaps know maybe how i can get through this?

Mataboge avatar Nov 24 '20 19:11 Mataboge

@Mataboge (and @EduardoReisDev and @gioggio79 too, so you can fix the incorrect workarounds for your projects), oh shoot. You're absolutely right. The previous candidate workarounds were both invalid. Luckily, there are a couple different workaround options.

Corrected candidate workaround option A

  1. If one of the invalid candidate workarounds for Xamarin.Google.Guava was previously applied, remove the workaround, delete the obj\project.assets.json, and close and reopen the solution to force the NuGet packages to re-restore.

  2. Install the Xamarin.AndroidX.Browser version 1.0.0 NuGet package to force a downgrade of that package to version 1.0.0.

Corrected candidate workaround option B

If the project needs to use a Xamarin.AndroidX.Browser version higher than 1.0.0, this is another option.

  1. If one of the invalid candidate workarounds for Xamarin.Google.Guava was previously applied, remove it.

  2. Open the .csproj project file for the Xamarin.Android app project in Visual Studio or another text editor.

  3. Find the <PropertyGroup> tag that contains the <PackageReference> elements for the project, and add the following additional <PackageReference> element to that list:

     <PackageReference Include="Xamarin.Google.Guava.ListenableFuture" ExcludeAssets="build;buildTransitive">
       <Version>1.0.0.2</Version>
     </PackageReference>
    
  4. Delete the obj\project.assets.json file and close and reopen the solution to force the NuGet packages to re-restore.

Explanation of candidate workaround option A

In Android Studio, the output of the dependencies Gradle task for com.google.firebase:firebase-firestore:21.4.3 reveals that there are transitive dependencies on the full Guava library:

These same dependencies exist even for the more recent com.google.firebase:firebase-firestore:22.0.0, so the Xamarin project needs to use the assets from the Xamarin.Google.Guava NuGet package, and the original candidate workarounds were invalid.

That said, unlike in the Xamarin.Android project, in the Android Studio project, adding com.google.android.gms:play-services-ads:19.1.0 doesn't add a dependency on com.google.guava:listenablefuture.

Dependency output for com.google.android.gms:play-services-ads:19.1.0
+--- com.google.android.gms:play-services-ads:19.1.0
|    +--- androidx.browser:browser:1.0.0
|    |    +--- androidx.core:core:1.0.0 -> 1.3.0 (*)
|    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |    +--- androidx.interpolator:interpolator:1.0.0 (*)
|    |    +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
|    |    \--- androidx.legacy:legacy-support-core-ui:1.0.0
|    |         +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |         +--- androidx.core:core:1.0.0 -> 1.3.0 (*)
|    |         +--- androidx.legacy:legacy-support-core-utils:1.0.0
|    |         |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |         |    +--- androidx.core:core:1.0.0 -> 1.3.0 (*)
|    |         |    +--- androidx.documentfile:documentfile:1.0.0
|    |         |    |    \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |         |    +--- androidx.loader:loader:1.0.0 (*)
|    |         |    +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
|    |         |    |    \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |         |    \--- androidx.print:print:1.0.0
|    |         |         \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |         +--- androidx.customview:customview:1.0.0 (*)
|    |         +--- androidx.viewpager:viewpager:1.0.0 (*)
|    |         +--- androidx.coordinatorlayout:coordinatorlayout:1.0.0
|    |         |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |         |    +--- androidx.core:core:1.0.0 -> 1.3.0 (*)
|    |         |    \--- androidx.customview:customview:1.0.0 (*)
|    |         +--- androidx.drawerlayout:drawerlayout:1.0.0 (*)
|    |         +--- androidx.slidingpanelayout:slidingpanelayout:1.0.0
|    |         |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |         |    +--- androidx.core:core:1.0.0 -> 1.3.0 (*)
|    |         |    \--- androidx.customview:customview:1.0.0 (*)
|    |         +--- androidx.interpolator:interpolator:1.0.0 (*)
|    |         +--- androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
|    |         |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |         |    +--- androidx.core:core:1.0.0 -> 1.3.0 (*)
|    |         |    \--- androidx.interpolator:interpolator:1.0.0 (*)
|    |         +--- androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
|    |         |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |         |    \--- androidx.core:core:1.0.0 -> 1.3.0 (*)
|    |         \--- androidx.cursoradapter:cursoradapter:1.0.0 (*)
|    +--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
|    +--- androidx.core:core:1.0.0 -> 1.3.0 (*)
|    +--- com.google.android.gms:play-services-ads-base:[19.1.0] -> 19.1.0
|    +--- com.google.android.gms:play-services-ads-identifier:17.0.0
|    |    \--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    +--- com.google.android.gms:play-services-ads-lite:[19.1.0] -> 19.1.0
|    |    +--- com.google.android.gms:play-services-ads-base:[19.1.0] -> 19.1.0
|    |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    \--- com.google.android.gms:play-services-measurement-sdk-api:17.1.0
|    |         +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |         \--- com.google.android.gms:play-services-measurement-base:[17.1.0] -> 17.1.0
|    |              \--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    \--- com.google.android.gms:play-services-gass:[19.1.0] -> 19.1.0
|         +--- com.google.android.gms:play-services-ads-base:[19.1.0] -> 19.1.0
|         +--- com.google.android.gms:play-services-ads-identifier:17.0.0 (*)
|         +--- com.google.android.gms:play-services-ads-lite:[19.1.0] -> 19.1.0 (*)
|         +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|         \--- com.google.android.gms:play-services-tasks:17.0.0 (*)

The difference is that the Xamarin project is using androidx.browser:browser:1.2.0 instead of androidx.browser:browser:1.0.0. androidx.browser:browser:1.2.0 has a dependency on com.google.guava:listenablefuture, while androidx.browser:browser:1.0.0 does not.

The new candidate workaround option A forces the androidx.browser:browser version to 1.0.0 to avoid the com.google.guava:listenablefuture dependency.

Explanation of candidate workaround option B

What happens if Android Studio is forced to use the "problematic" newer androidx.browser:browser:1.2.0 instead of androidx.browser:browser:1.0.0? In that case, there is a special dependency that avoids the conflict:

\--- com.google.guava:guava:28.1-android
|    |    |    |         +--- com.google.guava:failureaccess:1.0.1
|    |    |    |         +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
|    +--- androidx.browser:browser:1.0.0 -> 1.2.0
|    |    +--- androidx.core:core:1.1.0 -> 1.3.0 (*)
|    |    +--- androidx.annotation:annotation:1.1.0
|    |    \--- com.google.guava:listenablefuture:1.0 -> 9999.0-empty-to-avoid-conflict-with-guava

That is, the com.google.guava:guava artifact has a dependency on a special strange artifact version com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava that overrides other versions of com.google.guava:listenablefuture and provides an empty placeholder library that avoids conflicts with the full Guava library.

Because there is no corresponding special version "9999.0-empty-to-avoid-conflict-with-guava" of the Xamarin.Google.Guava.ListenableFuture NuGet package, the corrected candidate workaround option B takes a different approach to achieve a similar result. That NuGet package uses build and buildTransitive .targets files to instruct the Xamarin.Android build process to reference guava-listenablefuture.jar, so it's possible to stop the package from adding the .jar by excluding the build and buildTransitive assets from the NuGet package. After this change, when the app runs on a device, the androidx.browser:browser library will in theory reference the full Guava library that Firestore brings in, and everything will work happily. One caution is that I didn't have a test handy to try androidx.browser:browser hands-on in this build setup, but it should work without error.

brendanzagaeski avatar Nov 24 '20 22:11 brendanzagaeski

@brendanzagaeski thank you for your explanations and solutions.

Candidate B gave an Error saying Cannot Access Google.Guava.ListenableFuture.

Candidate A worked for me. Thank you very much.

Mataboge avatar Nov 26 '20 08:11 Mataboge

@brendanzagaeski really thanks for your assistance (and sorry for the delay in my response)

Candidate A don't work for me (I tried with v. 1.0.0 and 1.0.0.1 required for xamarin 4.8.0.1687) Compilation fail with error: Type com.google.common.util.concurrent.ListenableFuture is defined multiple times

Candidate B works like a charm, now I can build without java exit code 1. But I think there are some problem with cloud firestore.

I try to retrieve the database fields with

//var FirestoreIstance = FirebaseFirestore.GetInstance(MainActivity.MyFirebaseApp); <- I tried all two version to get firestoreIstance
var FirestoreIstance = FirebaseFirestore.Instance;
if (FirestoreIstance != null)
{
	try
	{
		var myMessages = FirestoreIstance.Collection("chatChannels").Document(ChannelId).Collection("messages");
		FirestoreIstance.Collection("chatChannels").Document(ChannelId).Collection("messages").OrderBy("time", Query.Direction.Descending).Limit(20).WhereLessThan("time", JavaDate).Get().AddOnCompleteListener(new GmsTaskCompletion((sender, e) =>
			{
			//code
			}));
	}
	catch (Exception e)
	{
		
	}

public class GmsTaskCompletion : Java.Lang.Object, IOnCompleteListener
	{
		public class GmsTaskEvent : EventArgs
		{
			public readonly Android.Gms.Tasks.Task task;
			public GmsTaskEvent(Android.Gms.Tasks.Task task) => this.task = task;
		}

		readonly EventHandler handler;
		public GmsTaskCompletion(EventHandler handler) => this.handler = handler;
		public void OnComplete(Android.Gms.Tasks.Task task)
		{
			if (handler != null)
				handler.Invoke(this, new GmsTaskEvent(task));
		}
	}

and application crash

12-03 12:18:14.472 E/AndroidRuntime(24974): FATAL EXCEPTION: main
12-03 12:18:14.472 E/AndroidRuntime(24974): Process: , PID: 24974
12-03 12:18:14.472 E/AndroidRuntime(24974): java.lang.RuntimeException: Internal error in Cloud Firestore (21.4.3).
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$3(com.google.firebase:firebase-firestore@@21.4.3:534)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run(Unknown Source:2)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at android.os.Handler.handleCallback(Handler.java:873)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at android.os.Handler.dispatchMessage(Handler.java:99)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at android.os.Looper.loop(Looper.java:201)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at android.app.ActivityThread.main(ActivityThread.java:6810)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at java.lang.reflect.Method.invoke(Native Method)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
12-03 12:18:14.472 E/AndroidRuntime(24974): Caused by: java.lang.NoSuchMethodError: No virtual method putPropagating(Lio/opencensus/tags/TagKey;Lio/opencensus/tags/TagValue;)Lio/opencensus/tags/TagContextBuilder; in class Lio/opencensus/tags/TagContextBuilder; or its super classes (declaration of 'io.opencensus.tags.TagContextBuilder' appears in /data/app/-xDdh2aAJ-YJ1bTONYB8cdg==/base.apk!classes2.dex)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at io.grpc.internal.CensusStatsModule$ClientCallTracer.<init>(CensusStatsModule.java:359)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at io.grpc.internal.CensusStatsModule.newClientCallTracer(CensusStatsModule.java:146)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at io.grpc.internal.CensusStatsModule$StatsClientInterceptor.interceptCall(CensusStatsModule.java:689)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at io.grpc.internal.ManagedChannelImpl.newCall(ManagedChannelImpl.java:814)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at io.grpc.internal.ForwardingManagedChannel.newCall(ForwardingManagedChannel.java:63)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at io.grpc.android.AndroidChannelBuilder$AndroidChannel.newCall(AndroidChannelBuilder.java:288)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at com.google.firebase.firestore.remote.GrpcCallProvider.lambda$createClientCall$0(com.google.firebase:firebase-firestore@@21.4.3:138)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at com.google.firebase.firestore.remote.GrpcCallProvider$$Lambda$1.then(Unknown Source:4)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at com.google.android.gms.tasks.zzg.run(com.google.android.gms:play-services-tasks@@17.0.2:2)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
12-03 12:18:14.472 E/AndroidRuntime(24974): 	at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(com.google.firebase:firebase-firestore@@21.4.3:229)

below the packages I'm using for Candidate A

<ItemGroup>
    <PackageReference Include="Branch-Xamarin-Linking-SDK">
      <Version>7.0.7</Version>
    </PackageReference>
    <PackageReference Include="CardsView">
      <Version>2.6.4</Version>
    </PackageReference>
    <PackageReference Include="CarouselView.FormsPlugin">
      <Version>5.2.0</Version>
    </PackageReference>
    <PackageReference Include="Com.Airbnb.Xamarin.Forms.Lottie">
      <Version>4.0.7</Version>
    </PackageReference>
    <PackageReference Include="Forms9Patch">
      <Version>2.4.6</Version>
    </PackageReference>
    <PackageReference Include="MLToolkit.Forms.SwipeCardView">
      <Version>2.2.0</Version>
    </PackageReference>
    <PackageReference Include="MR.Gestures">
      <Version>2.1.3</Version>
    </PackageReference>
    <PackageReference Include="Newtonsoft.Json">
      <Version>12.0.3</Version>
    </PackageReference>
    <PackageReference Include="PhotoBrowser.Forms">
      <Version>0.1.4</Version>
    </PackageReference>
    <PackageReference Include="Plugin.CurrentActivity">
      <Version>2.1.0.4</Version>
    </PackageReference>
    <PackageReference Include="Plugin.FirebasePushNotification">
      <Version>3.3.10</Version>
    </PackageReference>
    <PackageReference Include="Plugin.InAppBilling">
      <Version>2.0.0</Version>
    </PackageReference>
    <PackageReference Include="Plugin.LocalNotification">
      <Version>5.1.1</Version>
    </PackageReference>
    <PackageReference Include="Plugin.Permissions">
      <Version>6.0.1</Version>
    </PackageReference>
    <PackageReference Include="Rg.Plugins.Popup">
      <Version>2.0.0.7</Version>
    </PackageReference>
    <PackageReference Include="System.Net.Http">
      <Version>4.3.4</Version>
    </PackageReference>
    <PackageReference Include="UrhoSharp.Forms">
      <Version>1.9.67</Version>
    </PackageReference>
    <PackageReference Include="UrhoSharp.Tools">
      <Version>1.8.93</Version>
    </PackageReference>
    <PackageReference Include="Xam.Plugin.DeviceInfo">
      <Version>4.1.1</Version>
    </PackageReference>
    <PackageReference Include="Xam.Plugin.Media">
      <Version>4.0.1.5</Version>
    </PackageReference>
    <PackageReference Include="Xam.Plugin.SimpleAudioPlayer">
      <Version>1.4.0</Version>
    </PackageReference>
    <PackageReference Include="Xam.Plugins.Settings">
      <Version>4.1.0-beta</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData">
      <Version>2.2.0.3</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Firebase.Auth">
      <Version>119.3.1</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Firebase.Crashlytics">
      <Version>117.1.0</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Firebase.Datatransport">
      <Version>117.0.5</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Firebase.Firestore">
      <Version>121.4.3</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Firebase.Messaging">
      <Version>120.1.7</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Google.Android.Material">
      <Version>1.1.0.5</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.Browser">
      <Version>1.0.0</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4">
      <Version>1.0.0.5</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.MediaRouter">
      <Version>1.2.0</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.Browser">
      <Version>1.2.0.1</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4">
      <Version>1.0.0.1</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.FFImageLoading">
      <Version>2.4.11.982</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.FFImageLoading.Forms">
      <Version>2.4.11.982</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Firebase.Analytics">
      <Version>117.4.1</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Forms" Version="4.8.0.1687" />
    <PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
    <PackageReference Include="Xamarin.Forms.PancakeView">
      <Version>1.4.2</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Forms.Visual.Material">
      <Version>4.8.0.1687</Version>
    </PackageReference>
    <PackageReference Include="XF.Material">
      <Version>1.7.6</Version>
    </PackageReference>
  </ItemGroup>

gioggio79 avatar Dec 03 '20 11:12 gioggio79

Just to add that solution B) worked for me.

rjhind avatar Jan 08 '21 05:01 rjhind

I have the same problem after installing the following nuget packages in an Android project:

Xamarin.Firebase.Analytics (118.0.0) Xamarin.Firebase.Analytics.Impl (116.3.0)

This is the error I get:

Type com.google.android.gms.internal.measurement.zzu is defined multiple times: obj\Debug\100\lp\109\jl\classes.jar:com/google/android/gms/internal/measurement/zzu.class, obj\Debug\100\lp\123\jl\classes.jar:com/google/android/gms/internal/measurement/zzu.class (TaskId:185)

Workaround by downgrading to:

Xamarin.Firebase.Analytics (71.1630.4) Xamarin.Firebase.Analytics.Impl (71.1630.4)

...and also installing:

Xamarin.Android.Support.Core.Utils (28.0.0.3) Xamarin.Android.Support.Fragment (28.0.0.3)

Don't know if it actually works yet, but I don't get the build error anymore.

Repro steps: Make new Xamarin Forms solution with Android project. Add latest versions of the two packages above. Build.

greg84 avatar Jan 11 '21 16:01 greg84

Thanks a lot @greg84 Downgrading Firebase.Analytics and Firebase.Analytics.Impl to (71.1630.4) And then adding Xamarin.Android.Support.Core.Utils (28.0.0.3) and Xamarin.Android.Support.Fragment (28.0.0.3) worked perfectly for me

IzyPro avatar Jan 27 '21 19:01 IzyPro

Removing Xamarin.Firebase.Analytics.Impl which is not needed anymore worked for me.

cbovar avatar Feb 06 '21 15:02 cbovar

Removing Xamarin.Firebase.Analytics.Impl which is not needed anymore worked for me.

Thanks, this was the solution for me!

fabian-st avatar Feb 16 '21 16:02 fabian-st

the solution from @greg84 worked for me as well. Thanks for posting that, saved me a bunch of wasted time.

For what it's worth, I didn't need to install the support libs. My issue was fixed by simply downgrading the following

Xamarin.Firebase.Analytics (71.1630.4) Xamarin.Firebase.Analytics.Impl (71.1630.4)

banjahman avatar Feb 23 '21 20:02 banjahman