dotnet / android-libraries

.NET for Android bindings for Google's libraries, such as AndroidX, GooglePlayServices, Firebase, and MLKit and their 3rd party dependency libraries.
MIT License
233 stars 50 forks source link

Build error in LiveDataKt$observe$wrappedObserver$1.class #938

Open williambuchanan2 opened 3 months ago

williambuchanan2 commented 3 months ago

Android application type

Android for .NET (net6.0-android, etc.)

Affected platform version

VS2022

Description

I just installed the latest nuget packages and now I get the below build issue.

My app is .NET Maui on .NET 8

10>PDS.App.RedSix -> C:\Ws\Repo\DEV\PDS\NetCore\Client\REDSIX\bin\Debug\net8.0-android\PDS.App.RedSix.dll 10>MSBUILD : java.exe error JAVA0000: Error in obj\Debug\net8.0-android\lp\167\jl\classes.jar:androidx/lifecycle/LiveDataKt$observe$wrappedObserver$1.class: 10>MSBUILD : java.exe error JAVA0000: Type androidx.lifecycle.LiveDataKt$observe$wrappedObserver$1 is defined multiple times: obj\Debug\net8.0-android\lp\167\jl\classes.jar:androidx/lifecycle/LiveDataKt$observe$wrappedObserver$1.class, obj\Debug\net8.0-android\lp\212\jl\classes.jar:androidx/lifecycle/LiveDataKt$observe$wrappedObserver$1.class 10>MSBUILD : java.exe error JAVA0000: Compilation failed 10>MSBUILD : java.exe error JAVA0000: java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net8.0-android\lp\167\jl\classes.jar 10>MSBUILD : java.exe error JAVA0000: androidx/lifecycle/LiveDataKt$observe$wrappedObserver$1.class 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:135) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.D8.main(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5) 10>MSBUILD : java.exe error JAVA0000: Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net8.0-android\lp\167\jl\classes.jar:androidx/lifecycle/LiveDataKt$observe$wrappedObserver$1.class 10>MSBUILD : java.exe error JAVA0000: at Version.fakeStackEntry(Version_8.2.33.java:0) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.T.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:82) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:32) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:31) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.S0.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:2) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:42) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.D8.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:13) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:40) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:122) 10>MSBUILD : java.exe error JAVA0000: ... 1 more 10>MSBUILD : java.exe error JAVA0000: Caused by: com.android.tools.r8.utils.b: Type androidx.lifecycle.LiveDataKt$observe$wrappedObserver$1 is defined multiple times: obj\Debug\net8.0-android\lp\167\jl\classes.jar:androidx/lifecycle/LiveDataKt$observe$wrappedObserver$1.class, obj\Debug\net8.0-android\lp\212\jl\classes.jar:androidx/lifecycle/LiveDataKt$observe$wrappedObserver$1.class 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.Q2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:21) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:54) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:10) 10>MSBUILD : java.exe error JAVA0000: at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.graph.m4$a.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:61) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:12) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:9) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:45) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.D8.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:17) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.D8.c(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:69) 10>MSBUILD : java.exe error JAVA0000: at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:28) 10>MSBUILD : java.exe error JAVA0000: ... 6 more 10>MSBUILD : java.exe error JAVA0000: Directory 'obj\Debug\net8.0-android\lp\167' is from 'androidx.lifecycle.lifecycle-livedata-core.aar'.

Steps to Reproduce

Update nuget packages and build. I am using the following packages:

Xamarin.AndroidX.Activity Xamarin.AndroidX.Activity.Ktx Xamarin.AndroidX.Collection Xamarin.AndroidX.Collection.Ktx

Did you find any workaround?

No

Relevant log output

10>PDS.App.RedSix -> C:\Ws\Repo\DEV\PDS\NetCore\Client\REDSIX\bin\Debug\net8.0-android\PDS.App.RedSix.dll
10>MSBUILD : java.exe error JAVA0000: Error in obj\Debug\net8.0-android\lp\167\jl\classes.jar:androidx/lifecycle/LiveDataKt$observe$wrappedObserver$1.class:
10>MSBUILD : java.exe error JAVA0000: Type androidx.lifecycle.LiveDataKt$observe$wrappedObserver$1 is defined multiple times: obj\Debug\net8.0-android\lp\167\jl\classes.jar:androidx/lifecycle/LiveDataKt$observe$wrappedObserver$1.class, obj\Debug\net8.0-android\lp\212\jl\classes.jar:androidx/lifecycle/LiveDataKt$observe$wrappedObserver$1.class
10>MSBUILD : java.exe error JAVA0000: Compilation failed
10>MSBUILD : java.exe error JAVA0000: java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net8.0-android\lp\167\jl\classes.jar
10>MSBUILD : java.exe error JAVA0000: androidx/lifecycle/LiveDataKt$observe$wrappedObserver$1.class
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:135)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.D8.main(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
10>MSBUILD : java.exe error JAVA0000: Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net8.0-android\lp\167\jl\classes.jar:androidx/lifecycle/LiveDataKt$observe$wrappedObserver$1.class
10>MSBUILD : java.exe error JAVA0000:   at Version.fakeStackEntry(Version_8.2.33.java:0)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.T.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:82)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:32)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:31)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.utils.S0.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:2)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:42)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.D8.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:13)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:40)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:122)
10>MSBUILD : java.exe error JAVA0000:   ... 1 more
10>MSBUILD : java.exe error JAVA0000: Caused by: com.android.tools.r8.utils.b: Type androidx.lifecycle.LiveDataKt$observe$wrappedObserver$1 is defined multiple times: obj\Debug\net8.0-android\lp\167\jl\classes.jar:androidx/lifecycle/LiveDataKt$observe$wrappedObserver$1.class, obj\Debug\net8.0-android\lp\212\jl\classes.jar:androidx/lifecycle/LiveDataKt$observe$wrappedObserver$1.class
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.utils.Q2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:21)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:54)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:10)
10>MSBUILD : java.exe error JAVA0000:   at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.graph.m4$a.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:61)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:12)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:9)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:45)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.D8.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:17)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.D8.c(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:69)
10>MSBUILD : java.exe error JAVA0000:   at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:28)
10>MSBUILD : java.exe error JAVA0000:   ... 6 more
10>MSBUILD : java.exe error JAVA0000: Directory 'obj\Debug\net8.0-android\lp\167' is from 'androidx.lifecycle.lifecycle-livedata-core.aar'.
jpobst commented 3 months ago

https://github.com/xamarin/AndroidX/issues/764

moljac commented 3 months ago

Thanks for the feedback

Android for .NET (net6.0-android, etc.)

net6.0-android is out of support and you will not get the newest package versions.

I just installed the latest nuget packages and now I get the below build issue.

Please, provide list of packages

williambuchanan2 commented 3 months ago

Thanks for the feedback

Android for .NET (net6.0-android, etc.)

net6.0-android is out of support and you will not get the newest package versions.

I only chose net6.0-android because it was the closest option. When raising a bug this is the only 2 options you get:

image

I just installed the latest nuget packages and now I get the below build issue.

Please, provide list of packages

Xamarin.AndroidX.Activity 1.9.1 Xamarin.AndroidX.Activity.Ktx 1.9.1 Xamarin.AndroidX.Collection 1.4.2 Xamarin.AndroidX.Collection.Ktx 1.4.2

AlleSchonWeg commented 3 months ago

Similar error. I tried to update Xamarin.GooglePlayServices.Basement from version 118.3.0.1 to 118.4.0.1. I get this error:

1>MSBUILD : java.exe error JAVA0000: Error in obj\Debug\net8.0-android\lp\158\jl\classes.jar:androidx/lifecycle/ViewModelKt.class:
1>MSBUILD : java.exe error JAVA0000: Type androidx.lifecycle.ViewModelKt is defined multiple times: obj\Debug\net8.0-android\lp\158\jl\classes.jar:androidx/lifecycle/ViewModelKt.class, obj\Debug\net8.0-android\lp\194\jl\classes.jar:androidx/lifecycle/ViewModelKt.class
1>MSBUILD : java.exe error JAVA0000: Compilation failed
1>MSBUILD : java.exe error JAVA0000: java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net8.0-android\lp\158\jl\classes.jar
1>MSBUILD : java.exe error JAVA0000: androidx/lifecycle/ViewModelKt.class
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:135)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.D8.main(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
1>MSBUILD : java.exe error JAVA0000: Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: obj\Debug\net8.0-android\lp\158\jl\classes.jar:androidx/lifecycle/ViewModelKt.class
1>MSBUILD : java.exe error JAVA0000:    at Version.fakeStackEntry(Version_8.2.33.java:0)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.T.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:82)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:32)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:31)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.S0.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:2)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:42)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.D8.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:13)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:40)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:122)
1>MSBUILD : java.exe error JAVA0000:    ... 1 more
1>MSBUILD : java.exe error JAVA0000: Caused by: com.android.tools.r8.utils.b: Type androidx.lifecycle.ViewModelKt is defined multiple times: obj\Debug\net8.0-android\lp\158\jl\classes.jar:androidx/lifecycle/ViewModelKt.class, obj\Debug\net8.0-android\lp\194\jl\classes.jar:androidx/lifecycle/ViewModelKt.class
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.Q2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:21)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:54)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:10)
1>MSBUILD : java.exe error JAVA0000:    at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.graph.m4$a.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:61)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:12)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:9)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:45)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.D8.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:17)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.D8.c(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:69)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:28)
1>MSBUILD : java.exe error JAVA0000:    ... 6 more
1>MSBUILD : java.exe error JAVA0000: Directory 'obj\Debug\net8.0-android\lp\158' is from 'androidx.lifecycle.lifecycle-viewmodel-android.aar'.

Removing Xamarin.GooglePlayServices.Basement this error:

 Error in C:\nuget\xamarin.androidx.collection\1.2.0.9\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection.jar:androidx/collection/ArraySet$ElementIterator.class:
1>MSBUILD : java.exe error JAVA0000: Type androidx.collection.ArraySet$ElementIterator is defined multiple times: C:\nuget\xamarin.androidx.collection\1.2.0.9\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection.jar:androidx/collection/ArraySet$ElementIterator.class, C:\nuget\xamarin.androidx.collection.jvm\1.4.2\buildTransitive\net8.0-android34.0\..\..\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArraySet$ElementIterator.class
1>MSBUILD : java.exe error JAVA0000: Compilation failed
1>MSBUILD : java.exe error JAVA0000: java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\nuget\xamarin.androidx.collection\1.2.0.9\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection.jar
1>MSBUILD : java.exe error JAVA0000: androidx/collection/ArraySet$ElementIterator.class
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:135)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.D8.main(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
1>MSBUILD : java.exe error JAVA0000: Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\nuget\xamarin.androidx.collection\1.2.0.9\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection.jar:androidx/collection/ArraySet$ElementIterator.class
1>MSBUILD : java.exe error JAVA0000:    at Version.fakeStackEntry(Version_8.2.33.java:0)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.T.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:82)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:32)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:31)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.S0.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:2)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:42)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.D8.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:13)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:40)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:122)
1>MSBUILD : java.exe error JAVA0000:    ... 1 more
1>MSBUILD : java.exe error JAVA0000: Caused by: com.android.tools.r8.utils.b: Type androidx.collection.ArraySet$ElementIterator is defined multiple times: C:\nuget\xamarin.androidx.collection\1.2.0.9\buildTransitive\net6.0-android31.0\..\..\jar\androidx.collection.collection.jar:androidx/collection/ArraySet$ElementIterator.class, C:\nuget\xamarin.androidx.collection.jvm\1.4.2\buildTransitive\net8.0-android34.0\..\..\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArraySet$ElementIterator.class
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.Q2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:21)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:54)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:10)
1>MSBUILD : java.exe error JAVA0000:    at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.graph.m4$a.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:61)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:12)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:9)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.D8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:45)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.D8.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:17)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.D8.c(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:69)
1>MSBUILD : java.exe error JAVA0000:    at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:28)
1>MSBUILD : java.exe error JAVA0000:    ... 6 more
1>MSBUILD : java.exe error JAVA0000: 
wartedmars commented 2 months ago

try adding these packages Xamarin.AndroidX.Legacy.Support.V4 Xamarin.AndroidX.Lifecycle.LiveData Xamarin.Build.Download this worked for me

williambuchanan2 commented 2 months ago

try adding these packages Xamarin.AndroidX.Legacy.Support.V4 Xamarin.AndroidX.Lifecycle.LiveData Xamarin.Build.Download this worked for me

I couldn't even install these - I get a version conflict error.

These packages are a bit of a disaster...

jeff-eats-pubsubs commented 2 months ago

try adding these packages Xamarin.AndroidX.Legacy.Support.V4 Xamarin.AndroidX.Lifecycle.LiveData Xamarin.Build.Download this worked for me

Thank you very much @wartedmars for the recommendation. I was getting the same LiveDataKt$observe$wrappedObserver$1.class error building net8.0-android app after updating to the latest nugets. This seemed to quell the issue.

The last few times I've updated these packages it has caused build errors and forced me to add or remove packages. 😑

For reference:

I was missing

<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4">
      <Version>1.0.0.28</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData">
      <Version>2.8.4.1</Version>
</PackageReference>

Now I have

<!-- Relevent app packages -->
<PackageReference Include="Xamarin.Build.Download" Version="0.11.4" />

<!-- Android specific packages -->
<PackageReference Include="Xamarin.AndroidX.Activity">
    <Version>1.9.1.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx">
    <Version>1.9.1.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Collection">
    <Version>1.4.2.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Collection.Ktx">
    <Version>1.4.2.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4">
    <Version>1.0.0.28</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData">
    <Version>2.8.4.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Messaging">
    <Version>124.0.0.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.Dagger">
    <Version>2.52.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Base">
    <Version>118.5.0.1</Version>
</PackageReference>
dalibor-markovic commented 2 months ago

I had similar problem but different package. I solved it by updating "problematic" transient package version to the latest. After that other package version was causing the problem and I updated it as well, and so on. I was persistent and after several updates everything worked fine. I also updated "Microsoft.Maui.Controls" and etc.

In your case update "Xamarin.AndroidX.Lifecycle.LiveData.Core" package to the latest. After that probably some other package will throw exception. Find it in transient packages and update it too, and so on till project starts.

MGohil commented 2 months ago

Adding these 3 packages for Android solved this issue for me.

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core" Version="2.8.4.1"/>
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.8.4.1"/>
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.Common" Version="2.8.4.1"/>
</ItemGroup>
williambuchanan2 commented 1 month ago

Just checking.... Is there a plan to fix this? This is the permenant state of my Nuget window. Have had to train the team not to update any of these:

image

jpobst commented 1 month ago

If you are using MAUI, I think you will have to manually specify your transitive dependency versions until .NET 9 comes out. .NET 8 MAUI references packages from when .NET 8 came out (Nov 2023) which conflict with newer packages. I do not believe there is anything else that can be done on the binding side to fix this.