-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build error in LiveDataKt$observe$wrappedObserver$1.class #938
Comments
Thanks for the feedback
Please, provide list of packages |
I only chose net6.0-android because it was the closest option. When raising a bug this is the only 2 options you get:
Xamarin.AndroidX.Activity 1.9.1 |
Similar error. I tried to update Xamarin.GooglePlayServices.Basement from version 118.3.0.1 to 118.4.0.1. I get this error:
Removing Xamarin.GooglePlayServices.Basement this error:
|
try adding these packages |
I couldn't even install these - I get a version conflict error. These packages are a bit of a disaster... |
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> |
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. |
Adding these 3 packages for Android solved this issue for me.
|
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. |
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
The text was updated successfully, but these errors were encountered: