Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Type kotlin.collections.ArraysUtilJVM is defined multiple times #889

Closed
AlexMinchanka opened this issue Jul 10, 2024 · 4 comments
Closed

Comments

@AlexMinchanka
Copy link

AlexMinchanka commented Jul 10, 2024

Xamarin.Android Version (eg: 6.0):

.NET Android (net8.0-android, etc.)

Operating System & Version (eg: Mac OSX 10.11):

Windows 10 Enterprise

Describe your Issue

Android app compilation failed

Relevant information

Similar issues:
dotnet/android#7905

.csproj settings

<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<TargetFramework>net8.0-android</TargetFramework>
		<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
		<OutputType>Exe</OutputType>
		<Nullable>enable</Nullable>
		<ImplicitUsings>enable</ImplicitUsings>
		<ApplicationId>com.companyname.AndroidApp2</ApplicationId>
		<ApplicationVersion>1</ApplicationVersion>
		<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
	</PropertyGroup>
	<ItemGroup>
		<PackageReference Include="AppsFlyerXamarinBindingAndroid" Version="6.13.0" />
		<PackageReference Include="Square.OkHttp3" Version="4.12.0.4" />
	</ItemGroup>
</Project>

Packages used:

    <PackageReference Include="AppsFlyerXamarinBindingAndroid" Version="6.13.0" />
    <PackageReference Include="Square.OkHttp3" Version="4.12.0.4" />

Steps to Reproduce (with link to sample solution if possible):

  • Create android app(net8.0-android)
  • Reference two packages "AppsFlyerXamarinBindingAndroid" Version="6.13.0"
                       "Square.OkHttp3" Version="4.12.0.4"
  • Try to compile

Include any relevant Exception Stack traces, build logs, adb logs:

Relevant log output
Severity    Code  Description Project     File  Line  Suppression State Details
Error JAVA0000    Error in C:..\.nuget\packages\xamarin.kotlin.stdlib\1.9.23\buildTransitive\net7.0-android33.0\..\..\jar\org.jetbrains.kotlin.kotlin-stdlib-1.9.23.jar:kotlin/collections/ArraysUtilJVM.class:
Type kotlin.collections.ArraysUtilJVM is defined multiple times: C:..\.nuget\packages\xamarin.kotlin.stdlib\1.9.23\buildTransitive\net7.0-android33.0\..\..\jar\org.jetbrains.kotlin.kotlin-stdlib-1.9.23.jar:kotlin/collections/ArraysUtilJVM.class, obj\x64\Debug\net8.0-android34.0\lp\181\jl\libs\6DBB1223647C81C5.jar:kotlin/collections/ArraysUtilJVM.class
Compilation failed
java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:..\.nuget\packages\xamarin.kotlin.stdlib\1.9.23\buildTransitive\net7.0-android33.0\..\..\jar\org.jetbrains.kotlin.kotlin-stdlib-1.9.23.jar
kotlin/collections/ArraysUtilJVM.class
      at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:135)
      at com.android.tools.r8.R8.main(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: C:..\.nuget\packages\xamarin.kotlin.stdlib\1.9.23\buildTransitive\net7.0-android33.0\..\..\jar\org.jetbrains.kotlin.kotlin-stdlib-1.9.23.jar:kotlin/collections/ArraysUtilJVM.class
      at Version.fakeStackEntry(Version_8.2.33.java:0)
      at com.android.tools.r8.T.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:5)
      at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:82)
      at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:32)
      at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:31)
      at com.android.tools.r8.utils.S0.c(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:1)
      at com.android.tools.r8.R8.b(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:36)
      at com.android.tools.r8.R8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:2371)
      at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:122)
      ... 1 more
Caused by: com.android.tools.r8.utils.b: Type kotlin.collections.ArraysUtilJVM is defined multiple times: C:..\.nuget\packages\xamarin.kotlin.stdlib\1.9.23\buildTransitive\net7.0-android33.0\..\..\jar\org.jetbrains.kotlin.kotlin-stdlib-1.9.23.jar:kotlin/collections/ArraysUtilJVM.class, obj\x64\Debug\net8.0-android34.0\lp\181\jl\libs\6DBB1223647C81C5.jar:kotlin/collections/ArraysUtilJVM.class
      at com.android.tools.r8.utils.Q2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:21)
      at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:54)
      at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:10)
      at java.base/java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:2056)
      at com.android.tools.r8.utils.D2.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
      at com.android.tools.r8.graph.m4$a.d(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:6)
      at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:61)
      at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:12)
      at com.android.tools.r8.dex.c.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:9)
      at com.android.tools.r8.R8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:44)
      at com.android.tools.r8.R8.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:2370)
      at com.android.tools.r8.utils.S0.a(R8_8.2.33_429c93fd24a535127db6f4e2628eb18f2f978e02f99f55740728d6b22bef16dd:28)
      ... 5 more
Directory 'obj\x64\Debug\net8.0-android34.0\lp\181' is from 'AppsFlyerBinding.Android.aar'.
@jpobst
Copy link
Contributor

jpobst commented Jul 10, 2024

dotnet/android-libraries#764

@AlexMinchanka
Copy link
Author

AlexMinchanka commented Jul 12, 2024

Downgrading the package versions below helped

But this is a dangerous solution, the packages are too old:

<PackageVersion Include="Xamarin.Kotlin.StdLib" Version="1.5.10" />
<PackageVersion Include="Xamarin.Jetbrains.Annotations" Version="13.0.0.4" />

@moljac
Copy link
Member

moljac commented Jul 13, 2024

AppsFlyerXamarinBindingAndroid nuget should update dependencies.

https://www.nuget.org/packages/AppsFlyerXamarinBindingAndroid#dependencies-body-tab

@moljac
Copy link
Member

moljac commented Jul 19, 2024

closing this issue

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

No branches or pull requests

3 participants