[FIXED] com.android.tools.r8.CompilationFailedException

Issue

When trying to build my Xamarin project in Visual Studio 2022 I am receiving this error:

java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\120\lp\100\jl\bin\classes.jar : com/google/android/gms/measurement/internal/zzai.class

My build log shows this:

Error in obj\Debug\120\lp\100\jl\bin\classes.jar:com/google/android/gms/measurement/internal/zzai.class:

Type com.google.android.gms.measurement.internal.zzai is defined multiple times: obj\Debug\120\lp\100\jl\bin\classes.jar:com/google/android/gms/measurement/internal/zzai.class, obj\Debug\120\lp\101\jl\bin\classes.jar:com/google/android/gms/measurement/internal/zzai.class

I have used 7zip to extract the specified zzai.class file however I don’t know what to do from here. Trying to edit the file in notepad++ just shows noninterpretable code.

Solution

I fixed the issue by uninstalling unnecessary NuGet packages for Xamarin.GooglePlayServices.Measurement, only keeping the dependent packages required for Xamarin.Firebase.Analytics:

Xamarin.GooglePlayServices.Measurement

Xamarin.GooglePlayServices.Measurement.Api

Xamarin.GooglePlayServices.Measurement.Sdk

Answered By – roguedev

Answer Checked By – Mildred Charles (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published