maui: Build fails with `Xamarin.Android.D8.targets(79,5): MSB6006 "java.exe" exited with code 1`

Description

After update to preview11 app fails to build with: https://github.com/maxkoshevoi/NureTimetable/runs/4721371318?check_suite_focus=true#step:6:25

C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.101-preview.11.117\tools\Xamarin.Android.D8.targets(79,5): error MSB6006: "java.exe" exited with code 1.

It has been building fine in preview 10.

Steps to Reproduce

  1. Build this app https://github.com/maxkoshevoi/NureTimetable/tree/0f02e8f8ac5a927e97fb5e0ceee2a0dde78764d2 using preview 11

Version with bug

Preview 11

Last version that worked well

Preview 10 (current)

Affected platforms

Android

Affected platform versions

All

Did you find any workaround?

Works, but not always:

<Target Name="Remove1B1B3F705C33DF84" AfterTargets="_CheckDuplicateJavaLibraries">
  <ItemGroup>
    <ExtractedJarImportsToRemove Include="@(ExtractedJarImports)" Condition="'%(Filename)' == '1B1B3F705C33DF84'" />
    <ExtractedJarImports Remove="@(ExtractedJarImportsToRemove)" />
  </ItemGroup>
</Target>

Relevant log output

Type com.google.common.util.concurrent.ListenableFuture is defined multiple times
Error in C:\Users\Mi\.nuget\packages\xamarin.google.guava.listenablefuture\1.0.0.4\buildTransitive
et6.0-android31.0\..\..\jar\guava-listenablefuture.jar:com/google/common/util/concurrent/ListenableFuture.class:
Type com.google.common.util.concurrent.ListenableFuture is defined multiple times: C:\Users\Mi\.nuget\packages\xamarin.google.guava.listenablefuture\1.0.0.4\buildTransitive
et6.0-android31.0\..\..\jar\guava-listenablefuture.jar:com/google/common/util/concurrent/ListenableFuture.class, obj\Debug
et6.0-android31\lp\133\jl\libs\009E21B983A37ED6.jar:com/google/common/util/concurrent/ListenableFuture.class
Compilation failed
MSB6006: "java.exe" exited with code 1.
Done executing task "D8" -- FAILED.
Done building target "_CompileToDalvik" in project "NureTimetable.csproj" -- FAILED.
Done building project "NureTimetable.csproj" -- FAILED.
Build FAILED.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 17 (7 by maintainers)

Most upvoted comments

I also get the similar issue in VS 2022 community but I can fix it by changing dex compiler from d8 (default) to dx then build the project and i change dex compiler back to d8 as the default setting.

how do I do this exactly? thank you.

You can try it from your android project properties > android options > dex compiler

Are you on MAUI?

Installing syncfusion or Maui community toolkit in the newly created Maui program will both cause this problem.