Skip to content

[Xamarin.AndroidX.Core 1.7.0.1] error : java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete #525

Closed

Description

@AigioL

Version Information

  • Visual Studio version : 17.1.3
  • Xamarin.Android version : net6-android
  • Using AndroidX :
<PackageVersion Include="Xamarin.AndroidX.Camera.Camera2" Version="1.0.2.2" />
<PackageVersion Include="Xamarin.AndroidX.Camera.Lifecycle" Version="1.0.2.2" />

Describe your Issue:

  • See build logs
  • I guess it was triggered by package Xamarin.Google.Guava.ListenableFuture > 1.0.0.4
  • I found that downgrading the package to 1.0.2 fixes this bug

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

https://github.com/BeyondDimension/AspNetCore.Mobile/blob/test-ref-err-r8/src/AspNetCore.Mobile.Droid.NET6/AspNetCore.Mobile.Droid.NET6.csproj

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

1>目标 _CompileToDalvik:
1>  Error in C:\Users\*\.nuget\packages\xamarin.google.guava.listenablefuture\1.0.0.5\buildTransitive\net6.0-android31.0\..\..\jar\guava-listenablefuture.jar:com/google/common/util/concurrent/ListenableFuture.class:
1>  Type com.google.common.util.concurrent.ListenableFuture is defined multiple times: C:\Users\*\.nuget\packages\xamarin.google.guava.listenablefuture\1.0.0.5\buildTransitive\net6.0-android31.0\..\..\jar\guava-listenablefuture.jar:com/google/common/util/concurrent/ListenableFuture.class, obj\Debug\net6.0-android\lp\157\jl\libs\31DC00DFF80FA577.jar:com/google/common/util/concurrent/ListenableFuture.class
1>  Compilation failed
1>  Exception in thread "main" java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\*\.nuget\packages\xamarin.google.guava.listenablefuture\1.0.0.5\buildTransitive\net6.0-android31.0\..\..\jar\guava-listenablefuture.jar:com/google/common/util/concurrent/ListenableFuture.class
1>  	at com.android.tools.r8.internal.oO0.a(SourceFile:92)
1>  	at com.android.tools.r8.D8.main(D8.java:4)
1>  Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\*\.nuget\packages\xamarin.google.guava.listenablefuture\1.0.0.5\buildTransitive\net6.0-android31.0\..\..\jar\guava-listenablefuture.jar:com/google/common/util/concurrent/ListenableFuture.class
1>  	at Version.fakeStackEntry(Version_3.1.51.java:0)
1>  	at com.android.tools.r8.internal.oO0.a(SourceFile:68)
1>  	at com.android.tools.r8.internal.oO0.a(SourceFile:28)
1>  	at com.android.tools.r8.internal.oO0.a(SourceFile:27)
1>  	at com.android.tools.r8.internal.oO0.b(SourceFile:3)
1>  	at com.android.tools.r8.D8.a(D8.java:17)
1>  	at com.android.tools.r8.D8.a(D8.java:15)
1>  	at com.android.tools.r8.internal.oO0.a(SourceFile:84)
1>  	... 1 more
1>  Caused by: com.android.tools.r8.internal.b: Type com.google.common.util.concurrent.ListenableFuture is defined multiple times: C:\Users\*\.nuget\packages\xamarin.google.guava.listenablefuture\1.0.0.5\buildTransitive\net6.0-android31.0\..\..\jar\guava-listenablefuture.jar:com/google/common/util/concurrent/ListenableFuture.class, obj\Debug\net6.0-android\lp\157\jl\libs\31DC00DFF80FA577.jar:com/google/common/util/concurrent/ListenableFuture.class
1>  	at com.android.tools.r8.internal.il1.a(SourceFile:14)
1>  	at com.android.tools.r8.internal.il1.a(SourceFile:22)
1>  	at com.android.tools.r8.internal.lf1.b(SourceFile:6)
1>  	at com.android.tools.r8.internal.lf1.a(SourceFile:23)
1>  	at com.android.tools.r8.internal.lf1.a(SourceFile:10)
1>  	at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
1>  	at com.android.tools.r8.internal.lf1.a(SourceFile:6)
1>  	at com.android.tools.r8.graph.r2$a.f(SourceFile:4)
1>  	at com.android.tools.r8.dex.b.a(SourceFile:96)
1>  	at com.android.tools.r8.dex.b.a(SourceFile:21)
1>  	at com.android.tools.r8.D8.a(D8.java:21)
1>  	at com.android.tools.r8.D8.d(D8.java:11)
1>  	at com.android.tools.r8.D8.c(D8.java:1)
1>  	at com.android.tools.r8.internal.oO0.a(SourceFile:24)
1>  	... 5 more
1>  C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.200-preview.14.106\tools\Xamarin.Android.D8.targets(79,5): error : java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\*\.nuget\packages\xamarin.google.guava.listenablefuture\1.0.0.5\buildTransitive\net6.0-android31.0\..\..\jar\guava-listenablefuture.jar : com/google/common/util/concurrent/ListenableFuture.class
1>已完成在项目“AspNetCore.Mobile.Droid.NET6.csproj”中生成目标“_CompileToDalvik”的操作 - 失败。
1>
1>生成失败。
1>
...
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\31.0.200-preview.14.106\tools\Xamarin.Android.D8.targets(79,5): error : java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\*\.nuget\packages\xamarin.google.guava.listenablefuture\1.0.0.5\buildTransitive\net6.0-android31.0\..\..\jar\guava-listenablefuture.jar : com/google/common/util/concurrent/ListenableFuture.class

Activity

  1. jpobst commented on Apr 5, 2022

    @jpobst
    Contributor

    There was a bit of a mess trying to clean up the issues with ListenableFuture recently:

    dotnet/maui#5305
    dotnet/maui#5588

    If you are using MAUI you may need to wait for the next preview.

    If not, you might want to ensure all of your AndroidX packages are the latest, as these fixes were released within the last month.

  2. changed the title [-][Xamarin.Google.Guava.ListenableFuture] error : java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete[/-] [+][Xamarin.AndroidX.Core 1.7.0.1] error : java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete[/+] on Apr 5, 2022
  3. AigioL commented on Apr 5, 2022

    @AigioL
    Author

    I didn't use MAUI, and after trying multiple versions in the dependency package I found the problem was because Xamarin.AndroidX.Core 1.7.0.1

    ReactiveUI.AndroidX 17.1.50 -> Xamarin.AndroidX.Core 1.7.0.1, causing the error

  4. jpobst commented on Apr 5, 2022

    @jpobst
    Contributor

    Hmm, it is unfortunate that ReactiveUI.AndroidX is requiring a version of Xamarin.AndroidX.Core that has been delisted for being broken. (1.7.0.1)

    However as luck would have it, we just released 1.7.0.2 today which you can try.

  5. AigioL commented on Apr 6, 2022

    @AigioL
    Author

    I have just tested it and it can be fixed using this set of packages

    <PackageReference Include="Xamarin.AndroidX.Camera.Camera2" Version="1.0.2.4" />
    <PackageReference Include="Xamarin.AndroidX.Camera.Lifecycle" Version="1.0.2.4" />
    <PackageReference Include="Xamarin.Google.Guava.ListenableFuture" Version="1.0.0.6" />
    <PackageReference Include="ReactiveUI.AndroidX" Version="17.1.50" />
    <PackageReference Include="Xamarin.AndroidX.Core" Version="1.7.0.2" />
    <PackageReference Include="Xamarin.AndroidX.Legacy.Support.Core.UI" Version="1.0.0.14" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.4.1.1" />
    <PackageReference Include="Xamarin.AndroidX.Preference" Version="1.2.0.1" />
    <PackageReference Include="Xamarin.Google.Android.Material" Version="1.5.0.2" />
    
  6. added a commit that references this issue on Apr 6, 2022
  7. jpobst commented on Apr 6, 2022

    @jpobst
    Contributor

    Excellent, thanks for testing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions