Skip to content
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

Can not update nugets, see error Type androidx.lifecycle.DefaultLifecycleObserver is defined multiple times #634

Closed
ivmazurenko opened this issue Oct 19, 2022 · 7 comments
Assignees

Comments

@ivmazurenko
Copy link

Android application type

Classic Xamarin.Android (MonoAndroid12.0, etc.)

Affected platform version

VS 2022

Description

Can not update nugets

  Error in C:\Users\imazurenko\.nuget\packages\xamarin.androidx.lifecycle.common\2.5.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DefaultLifecycleObserver.class:
Type androidx.lifecycle.DefaultLifecycleObserver is defined multiple times: C:\Users\imazurenko\.nuget\packages\xamarin.androidx.lifecycle.common\2.5.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DefaultLifecycleObserver.class, obj\Debug\120\lp\0\jl\lifecycle-common-java8-2.2.0.jar:androidx/lifecycle/DefaultLifecycleObserver.class
Compilation failed
java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\imazurenko\.nuget\packages\xamarin.androidx.lifecycle.common\2.5.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar
androidx/lifecycle/DefaultLifecycleObserver.class
	at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:98)
	at com.android.tools.r8.R8.main(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:4)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\imazurenko\.nuget\packages\xamarin.androidx.lifecycle.common\2.5.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DefaultLifecycleObserver.class
	at Version.fakeStackEntry(Version_3.3.28.java:0)
	at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:75)
	at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:28)
	at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:27)
	at com.android.tools.r8.R8.b(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:1133)
	at com.android.tools.r8.R8.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:2212)
	at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:85)
	... 1 more
Caused by: com.android.tools.r8.internal.f: Type androidx.lifecycle.DefaultLifecycleObserver is defined multiple times: C:\Users\imazurenko\.nuget\packages\xamarin.androidx.lifecycle.common\2.5.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DefaultLifecycleObserver.class, obj\Debug\120\lp\0\jl\lifecycle-common-java8-2.2.0.jar:androidx/lifecycle/DefaultLifecycleObserver.class
	at com.android.tools.r8.internal.DT.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:14)
	at com.android.tools.r8.internal.DT.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:22)
	at com.android.tools.r8.internal.CN.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:33)
	at com.android.tools.r8.internal.CN.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:10)
	at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
	at com.android.tools.r8.internal.CN.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:6)
	at com.android.tools.r8.graph.B2$a.e(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:4)
	at com.android.tools.r8.dex.b.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:105)
	at com.android.tools.r8.dex.b.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:28)
	at com.android.tools.r8.R8.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:902)
	at com.android.tools.r8.R8.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:2211)
	at com.android.tools.r8.internal.Bj.a(R8_3.3.28_2aaf796388b4e9f6bed752d926eca110512a53a3f09a8d755196089c1cfdf799:24)
	... 4 more
Directory 'obj\Debug\120\lp\0' is from 'Analytics.Droid.dll'.

Steps to Reproduce

1.1.0.9

Did you find any workaround?

No

Relevant log output

No response

@moljac
Copy link
Contributor

moljac commented Oct 24, 2022

thanks for the feedback. Please add your <PackageReference>s here.

@moljac moljac self-assigned this Oct 24, 2022
@ivmazurenko
Copy link
Author

Solved. Was impored broken AAR binding ligrarey

@aman-jain17
Copy link

Solved. Was impored broken AAR binding ligrarey

How did you solve this issue? can you please explain a bit?

@moljac
Copy link
Contributor

moljac commented Apr 21, 2023

possibly related

#717

xamarin/GooglePlayServicesComponents#694

@moljac
Copy link
Contributor

moljac commented Apr 21, 2023

Workaround to test

xamarin/GooglePlayServicesComponents#694 (comment)

@moljac
Copy link
Contributor

moljac commented Jun 1, 2023

As temp workaround try explicitly adding following PackageReferences:

		<PackageReference Include="Xamarin.AndroidX.Activity" Version="1.7.2" />
		<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.7.2" />

and yes - please report here if workaround works.

@fmj4912
Copy link

fmj4912 commented Jun 15, 2023

The workaround works for me

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

No branches or pull requests

4 participants