Skip to content

Upgrading Xamarin.AndroidX.Lifecycle packages to version 2.6.1 makes the build fail for duplicated classes #717

Closed

Description

@XDarinor

Android application type

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

Affected platform version

Visual Studio 2022 Enterprise, Windows 11, Xamarin.Android, build tools Android 13

Description

Upgrading packages Xamarin.AndroidX.Lifecycle.Runtime from previous version to 2.6.1 causes a Java error:

Error in G:\NuGET\Packages\xamarin.androidx.lifecycle.common\2.6.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DispatchQueue.class:
Type androidx.lifecycle.DispatchQueue is defined multiple times: G:\NuGET\Packages\xamarin.androidx.lifecycle.common\2.6.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DispatchQueue.class, obj\Debug\130\lp\150\jl\classes.jar:androidx/lifecycle/DispatchQueue.class
Compilation failed

This will happen also if the update is triggered by updating another NuGet packaged that have a dependecy on Lifecycle packages, like Xamarin.AndroidX.Fragment

Steps to Reproduce

Open solution NuGet packages, then upgrade Lifecycle related packages.

Did you find any workaround?

Just to not update the NuGet packges makes the solution work again.

Relevant log output

Error in G:\NuGET\Packages\xamarin.androidx.lifecycle.common\2.6.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DispatchQueue.class:
Type androidx.lifecycle.DispatchQueue is defined multiple times: G:\NuGET\Packages\xamarin.androidx.lifecycle.common\2.6.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DispatchQueue.class, obj\Debug\130\lp\150\jl\classes.jar:androidx/lifecycle/DispatchQueue.class
Compilation failed
java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: G:\NuGET\Packages\xamarin.androidx.lifecycle.common\2.6.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar
androidx/lifecycle/DispatchQueue.class
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:98)
	at com.android.tools.r8.D8.main(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:4)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: G:\NuGET\Packages\xamarin.androidx.lifecycle.common\2.6.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DispatchQueue.class
	at Version.fakeStackEntry(Version_3.3.75.java:0)
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:75)
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:28)
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:27)
	at com.android.tools.r8.internal.Fj.b(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:2)
	at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:22)
	at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:17)
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:85)
	... 1 more
Caused by: com.android.tools.r8.internal.f: Type androidx.lifecycle.DispatchQueue is defined multiple times: G:\NuGET\Packages\xamarin.androidx.lifecycle.common\2.6.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DispatchQueue.class, obj\Debug\130\lp\150\jl\classes.jar:androidx/lifecycle/DispatchQueue.class
	at com.android.tools.r8.internal.JT.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:14)
	at com.android.tools.r8.internal.JT.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:22)
	at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:33)
	at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:10)
	at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
	at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:6)
	at com.android.tools.r8.graph.B2$a.e(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:4)
	at com.android.tools.r8.dex.b.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:110)
	at com.android.tools.r8.dex.b.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:28)
	at com.android.tools.r8.D8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:25)
	at com.android.tools.r8.D8.d(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:606)
	at com.android.tools.r8.D8.c(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:1)
	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:24)
	... 5 more
Directory 'obj\Debug\130\lp\150' is from 'androidx.lifecycle.lifecycle-runtime-ktx.aar'.

Activity

  1. moljac commented on Apr 13, 2023

    @moljac
    Contributor

    Thanks for reporting. Do you have repro sample or at least <PackageReference> list

  2. tbalcom commented on Apr 19, 2023

    @tbalcom

    I'm seeing the same DispatchQueue error while attempting to update Xamarin.AndroidX.Work.Runtime from 2.7.1.6 to 2.8.1. Here is my <PackageReference> list for the Android project:

        <PackageReference Include="Microsoft.AppCenter.Analytics" Version="5.0.1" />
        <PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.1" />
        <PackageReference Include="Microsoft.AppCenter.Distribute" Version="5.0.1" />
        <PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
        <PackageReference Include="MvvmCross" Version="8.0.2" />
        <PackageReference Include="MvvmCross.DroidX.Material" Version="8.0.2" />
        <PackageReference Include="MvvmCross.DroidX.RecyclerView" Version="8.0.2" />
        <PackageReference Include="MvvmCross.Plugin.Messenger" Version="8.0.2" />
        <PackageReference Include="MvvmCross.Plugin.ResxLocalization" Version="8.0.2" />
        <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
        <PackageReference Include="Serilog" Version="2.12.0" />
        <PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
        <PackageReference Include="Serilog.Formatting.Compact" Version="1.1.0" />
        <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
        <PackageReference Include="Serilog.Sinks.Xamarin" Version="1.0.0" />
        <PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
        <PackageReference Include="System.Net.Http" Version="4.3.4" />
        <PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.0.3" />
        <PackageReference Include="Xamarin.AndroidX.Preference" Version="1.2.0.4" />
        <PackageReference Include="Xamarin.AndroidX.Work.Runtime" Version="2.7.1.6" />
        <PackageReference Include="Xamarin.AndroidX.ConstraintLayout" Version="2.1.4.3" />
        <PackageReference Include="Xamarin.AndroidX.CardView" Version="1.0.0.18" />
        <PackageReference Include="Xamarin.Essentials" Version="1.7.5" />
        <PackageReference Include="Xamarin.Firebase.Messaging" Version="123.1.1.1" />
        <PackageReference Include="Xamarin.Google.Android.Material" Version="1.8.0" />
        <PackageReference Include="Xamarin.Google.Dagger" Version="2.44.2.1" />
        <PackageReference Include="Xamarin.GooglePlayServices.Location" Version="120.0.0.1" />
        <PackageReference Include="Xamarin.GooglePlayServices.Maps" Version="118.1.0.1" />
        <PackageReference Include="Xamarin.Kotlin.StdLib.Jdk8" Version="1.8.10" />
        <PackageReference Include="ZXing.Net.Mobile" Version="3.1.0-beta2" />
  3. XDarinor commented on Apr 19, 2023

    @XDarinor
    Author

    Thanks for reporting. Do you have repro sample or at least <PackageReference> list

    I'm sorry for the late answer. I don't have a repro sample, but I can share the PackageReferences below:

    <ItemGroup>
        <PackageReference Include="Microsoft.AppCenter.Analytics">
          <Version>5.0.1</Version>
        </PackageReference>
        <PackageReference Include="Microsoft.AppCenter.Crashes">
          <Version>5.0.1</Version>
        </PackageReference>
        <PackageReference Include="NLog">
          <Version>5.1.3</Version>
        </PackageReference>
        <PackageReference Include="Polly">
          <Version>7.2.3</Version>
        </PackageReference>
        <PackageReference Include="Syncfusion.Licensing">
          <Version>21.1.38</Version>
        </PackageReference>
        <PackageReference Include="Syncfusion.Xamarin.SfAutoComplete.Android">
          <Version>21.1.38</Version>
        </PackageReference>
        <PackageReference Include="Syncfusion.Xamarin.SfRotator.Android">
          <Version>21.1.38</Version>
        </PackageReference>
        <PackageReference Include="Syncfusion.Xamarin.SfSchedule.Android">
          <Version>21.1.38</Version>
        </PackageReference>
        <PackageReference Include="Syncfusion.Xamarin.SfTreeView.Android">
          <Version>21.1.38</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.Android.Support.v7.RecyclerView">
          <Version>28.0.0.3</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.AppCompat">
          <Version>1.6.0.1</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Fragment">
          <Version>1.5.5.1</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Legacy.Support.Core.UI">
          <Version>1.0.0.17</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData">
          <Version>2.5.1.2</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Migration">
          <Version>1.0.10</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Navigation.Fragment">
          <Version>2.5.3.1</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Navigation.Runtime">
          <Version>2.5.3.1</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Navigation.UI">
          <Version>2.5.3.1</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.AndroidX.Startup.StartupRuntime">
          <Version>1.1.1.4</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.Essentials" Version="1.7.5" />
        <PackageReference Include="Xamarin.Google.Android.DataTransport.TransportBackendCct">
          <Version>3.1.8.1</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.Google.Android.DataTransport.TransportRuntime">
          <Version>3.1.8.1</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.Google.Android.Material">
          <Version>1.8.0</Version>
        </PackageReference>
        <PackageReference Include="Realm">
          <Version>10.21.0</Version>
        </PackageReference>
        <PackageReference Include="Newtonsoft.Json">
          <Version>13.0.3</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.Firebase.Messaging">
          <Version>123.1.1.1</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.Google.Dagger">
          <Version>2.44.2.1</Version>
        </PackageReference>
        <PackageReference Include="Xamarin.GooglePlayServices.Base">
          <Version>118.1.0.1</Version>
        </PackageReference>
        <PackageReference Include="Microsoft.Identity.Client">
          <Version>4.52.0</Version>
        </PackageReference>
      </ItemGroup>
    

    Do you think this is enough? What also is needed?

  4. moljac commented on Apr 20, 2023

    @moljac
    Contributor

    @XDarinor @tbalcom

    Thanks for the lists. I will try to make repro sample[s] out of those.

  5. moljac commented on Apr 20, 2023

    @moljac
    Contributor

    I'm sorry for the late answer. I don't have a repro sample, but I can share the PackageReferences below:

    It is OK. Thanks

    Do you think this is enough? What also is needed?

    I hope so. Usually it is versions mismatch of the transitive dependencies.

  6. moljac commented on Apr 21, 2023

    @moljac
    Contributor
  7. moljac commented on Apr 21, 2023

    @moljac
    Contributor
  8. tbalcom commented on Apr 21, 2023

    @tbalcom

    The workaround didn't help. I've also tried explicitly referencing the latest Xamarin.AndroidX.Lifecycle (Common, Common.Java8, Extensions) packages with no success.

  9. tbalcom commented on Apr 21, 2023

    @tbalcom

    The full error:

    Error in C:\Users\Trevor\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DispatchQueue.class:
    Type androidx.lifecycle.DispatchQueue is defined multiple times: C:\Users\Trevor\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DispatchQueue.class, obj\Debug\130\lp\161\jl\classes.jar:androidx/lifecycle/DispatchQueue.class
    Compilation failed
    java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\Trevor\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar
    androidx/lifecycle/DispatchQueue.class
    	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:98)
    	at com.android.tools.r8.R8.main(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:4)
    Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:\Users\Trevor\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DispatchQueue.class
    	at Version.fakeStackEntry(Version_3.3.75.java:0)
    	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:75)
    	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:28)
    	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:27)
    	at com.android.tools.r8.R8.b(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:1133)
    	at com.android.tools.r8.R8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:2212)
    	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:85)
    	... 1 more
    Caused by: com.android.tools.r8.internal.f: Type androidx.lifecycle.DispatchQueue is defined multiple times: C:\Users\Trevor\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1\buildTransitive\monoandroid12.0\..\..\jar\androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DispatchQueue.class, obj\Debug\130\lp\161\jl\classes.jar:androidx/lifecycle/DispatchQueue.class
    	at com.android.tools.r8.internal.JT.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:14)
    	at com.android.tools.r8.internal.JT.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:22)
    	at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:33)
    	at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:10)
    	at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2048)
    	at com.android.tools.r8.internal.HN.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:6)
    	at com.android.tools.r8.graph.B2$a.e(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:4)
    	at com.android.tools.r8.dex.b.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:110)
    	at com.android.tools.r8.dex.b.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:28)
    	at com.android.tools.r8.R8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:902)
    	at com.android.tools.r8.R8.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:2211)
    	at com.android.tools.r8.internal.Fj.a(R8_3.3.75_b7a6ff6b13548611571508fe72282c9167faa649161ca0013edfc92e19bd7e58:24)
    	... 4 more
    Directory 'obj\Debug\130\lp\161' is from 'androidx.lifecycle.lifecycle-runtime-ktx.aar'.
    
  10. moljac commented on Apr 24, 2023

    @moljac
    Contributor

    @XDarinor

    This is big problem:

    		<PackageReference Include="Xamarin.Android.Support.v7.RecyclerView">
    		<Version>28.0.0.3</Version>
    		</PackageReference>
    

    Android support libraries are not supported anymore.

  11. XDarinor commented on Apr 24, 2023

    @XDarinor
    Author

    @XDarinor

    This is big problem:

    
    		<PackageReference Include="Xamarin.Android.Support.v7.RecyclerView">
    
    		<Version>28.0.0.3</Version>
    
    		</PackageReference>
    
    

    Android support libraries are not supported anymore.

    Mmm this could be a great issue. I think this package could be needed for the Syncfusion Treeview. I will try tomorrow to remove it and see if everything works out.

  12. moljac commented on Apr 25, 2023

    @moljac
    Contributor

    @XDarinor

    Mmm this could be a great issue.

    I'm not telling this is the root cause, but Android Support causes issues with modern apps which use AndroidX.

    I think this package could be needed for the Syncfusion Treeview.

    Could be. Try updating Treeview. Though I think you should not need to add some dependency for Treeview manually.

    Or try removing Xamarin.Android.Support.v7.RecyclerView and see what screams with errors.

    I will try tomorrow to remove it and see if everything works out.

    Great.

  13. wfhm commented on Apr 26, 2023

    @wfhm

    Same here. Visual Studio for Mac 17.5.3 (build 15), MAUI net7.0 app.

    /Users/vromanychev/Projects/PushwooshSDK.DotNet/Sample: Error JAVA0000: Error in /Users/vromanychev/.nuget/packages/xamarin.androidx.lifecycle.common/2.6.1/buildTransitive/net6.0-android31.0/../../jar/androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DispatchQueue.class:
    Type androidx.lifecycle.DispatchQueue is defined multiple times: /Users/vromanychev/.nuget/packages/xamarin.androidx.lifecycle.common/2.6.1/buildTransitive/net6.0-android31.0/../../jar/androidx.lifecycle.lifecycle-common.jar:androidx/lifecycle/DispatchQueue.class, obj/Debug/net7.0-android/lp/173/jl/classes.jar:androidx/lifecycle/DispatchQueue.class
    

    Package reference list:

        <ItemGroup>
        <PackageReference Include="Xamarin.AndroidX.Core" Version="1.9.0.2" />
        <PackageReference Include="Xamarin.AndroidX.Arch.Core.Common" Version="2.2.0" />
        <PackageReference Include="Xamarin.AndroidX.Arch.Core.Runtime" Version="2.2.0" />
        <PackageReference Include="Xamarin.AndroidX.Activity" Version="1.7.0" />
        <PackageReference Include="Xamarin.AndroidX.Fragment" Version="1.5.6" />
        <PackageReference Include="Xamarin.AndroidX.Work.Runtime" Version="2.7.1.5" />
        <PackageReference Include="Xamarin.Firebase.Messaging" Version="123.1.1.1" />
        <PackageReference Include="Xamarin.Firebase.Iid" Version="121.1.0.8" />
        <PackageReference Include="Xamarin.Firebase.Common" Version="120.2.0.1" />
        <PackageReference Include="Xamarin.Firebase.Installations" Version="117.1.0.1" />
        <PackageReference Include="Xamarin.Firebase.Annotations" Version="116.1.0.1" />
        <PackageReference Include="Xamarin.GooglePlayServices.Basement" Version="118.1.0.2" />
        <PackageReference Include="Xamarin.GooglePlayServices.Base" Version="118.1.0.1" />
        <PackageReference Include="Xamarin.GooglePlayServices.CloudMessaging" Version="117.0.2.3" />
        <PackageReference Include="Xamarin.AndroidX.SwipeRefreshLayout" Version="1.1.0.11" />
        <PackageReference Include="Xamarin.AndroidX.ConstraintLayout" Version="2.1.4.3" />
      </ItemGroup>
    

    It's a fresh project so I wasn't updating Xamarin.AndroidX.Work.Runtime, just added the 2.7.1.5 version. The workaround didn't help.

    Directory 'obj/Debug/net7.0-android/lp/173' is from 'androidx.lifecycle.lifecycle-runtime-ktx.aar' (double-checked it with map.cache).

  14. tipa commented on Apr 26, 2023

    @tipa

    The problem can be easily reproduced by simply adding these two dependencies:

    Xamarin.AndroidX.Camera.Camera2 v1.2.2
    Xamarin.AndroidX.Preference v1.2.0.4
    

    AndroidApp1.zip

  15. 15 remaining items

  16. moljac commented on May 12, 2023

    @moljac
    Contributor

    Closing this issue

  17. sphix0108 commented on May 16, 2023

    @sphix0108

    Hi,
    I encountered the similar problem with: Type androidx.lifecycle.DispatchQueue is defined mutiple times.
    How to check the dependencies that causes the error?

  18. moljac commented on May 16, 2023

    @moljac
    Contributor

    Hi, I encountered the similar problem with: Type androidx.lifecycle.DispatchQueue is defined mutiple times.

    Just update all dependencies to latest. Note: GPS-FB-MLKit or other 3rd party package might still cause issues. Namely GPS-FB-MLKit is not yet "aligned", so particular dependency could pull in problematic older packages and issue could be hit again.

    How to check the dependencies that causes the error?

    It is not that easy. In some cases Xamarin.AndroidX.Lifecycle.*, but in other cases combination of any could cause problems (check tipa's dependencies in this issue).

  19. sphix0108 commented on May 19, 2023

    @sphix0108

    Thanks for your reply.
    I am trying to use Xamarin.AndroidX.Biometric <= this one is culprit but I don't know how to/ which dependencies should be upgrade together with it. I am fairly new to MAUI/Xamarin and development in all.
    If you have any suggestion, it will be very helpful. Thanks

  20. sphix0108 commented on May 19, 2023

    @sphix0108

    Thanks for your reply. I am trying to use Xamarin.AndroidX.Biometric <= this one is culprit but I don't know how to/ which dependencies should be upgrade together with it.

    I tried downgraded the the Xamarin.AndroidX.BioMetric and *.AndroidX.Core to the previous level (Biometric = 1.1.0.10 & Core = 1.8.0.1) then I can build the project successfully. Just for a report, since my project is approaching deadline, I cannot check more regarding this problem.
    Thank you for your support.

  21. moljac commented on May 24, 2023

    @moljac
    Contributor
  22. Lsdenis commented on May 31, 2023

    @Lsdenis

    Possible Workaround

    I had a similar problem, but with another packages. So, basically this thread helped to understand the root of the problem.

    Problem:

    Type androidx.activity.OnBackPressedDispatcherKt is defined multiple times: 
      obj/Debug/net6.0-android33.0/lp/111/jl/classes.jar:androidx/activity/OnBackPressedDispatcherKt.class, 
      obj/Debug/net6.0-android33.0/lp/143/jl/classes.jar:androidx/activity/OnBackPressedDispatcherKt.class
    

    I went into the both paths obj/Debug/net6.0-android33.0/lp/111/jl/ and obj/Debug/net6.0-android33.0/lp/143/jl/, checked the manifests inside and installed both libraries explicitly.
    In my case they are:

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

    I performed a quick smoke test and looks like it work, but no guarantee yet.

    Maybe it'll help someone :)

  23. moljac commented on Jun 1, 2023

    @moljac
    Contributor

    Possible Workaround

    @Lsdenis

    Thanks for the feedback.

    I had a similar problem, but with another packages.

    Yes it is about transitive dependencies and what gets referenced + google moving types around.

    So, basically this thread helped to understand the root of the problem.

    Problem:

    Type androidx.activity.OnBackPressedDispatcherKt is defined multiple times: 
      obj/Debug/net6.0-android33.0/lp/111/jl/classes.jar:androidx/activity/OnBackPressedDispatcherKt.class, 
      obj/Debug/net6.0-android33.0/lp/143/jl/classes.jar:androidx/activity/OnBackPressedDispatcherKt.class
    

    I went into the both paths obj/Debug/net6.0-android33.0/lp/111/jl/ and obj/Debug/net6.0-android33.0/lp/143/jl/, checked the manifests inside and installed both libraries explicitly. In my case they are:

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

    I performed a quick smoke test and looks like it work, but no guarantee yet.

    It works on few other samples I am investigating. Still several to do.

    Maybe it'll help someone :)

    It did. Thanks

  24. moljac commented on Jun 1, 2023

    @moljac
    Contributor

    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.

  25. tklempay commented on Jun 8, 2023

    @tklempay

    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.

    In the process of porting a Xamarin native app (android and ios) to .NET MAUI. In the port of android, fixed all of the compilation errors only to hit this bug. Adding your explicit package references cleared up the error. Thanks!

  26. moljac commented on Jun 11, 2023

    @moljac
    Contributor

    @tklempay Thanks for the feedback!

  27. moljac commented on Jul 9, 2023

    @moljac
    Contributor

    Duplicates:

    #717
    #742
    #747
    #749

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