MAUI .NET 8 on Android - throwing an exception

KarPreet 80 Reputation points
2024-11-06T08:52:37.01+00:00

MSBUILD : java.exe error JAVA0000: Error in C:\Users\jeeva.nuget\packages\xamarin.androidx.collection.jvm\1.4.3.1\buildTransitive\net8.0-android34.0....\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class:

1>MSBUILD : java.exe error JAVA0000: Type androidx.collection.ArrayMapKt is defined multiple times: C:\Users\jeeva.nuget\packages\xamarin.androidx.collection.jvm\1.4.3.1\buildTransitive\net8.0-android34.0....\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class, C:\Users\jeeva.nuget\packages\xamarin.androidx.collection.ktx\1.2.0.9\buildTransitive\net6.0-android31.0....\jar\androidx.collection.collection-ktx.jar:androidx/collection/ArrayMapKt.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:\Users\jeeva.nuget\packages\xamarin.androidx.collection.jvm\1.4.3.1\buildTransitive\net8.0-android34.0....\jar\androidx.collection.collection-jvm.jar

1>MSBUILD : java.exe error JAVA0000: androidx/collection/ArrayMapKt.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:\Users\jeeva.nuget\packages\xamarin.androidx.collection.jvm\1.4.3.1\buildTransitive\net8.0-android34.0....\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.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.ArrayMapKt is defined multiple times: C:\Users\jeeva.nuget\packages\xamarin.androidx.collection.jvm\1.4.3.1\buildTransitive\net8.0-android34.0....\jar\androidx.collection.collection-jvm.jar:androidx/collection/ArrayMapKt.class, C:\Users\jeeva.nuget\packages\xamarin.androidx.collection.ktx\1.2.0.9\buildTransitive\net6.0-android31.0....\jar\androidx.collection.collection-ktx.jar:androidx/collection/ArrayMapKt.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:

I have an in-app subscription in my project, and I used Xamarin.Android.Google.BillingClient package in migrated MAUI project.
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">

      	 <PackageReference Include="Xamarin.Android.Google.BillingClient">

			<Version>7.1.1</Version>

</PackageReference>
```</ItemGroup>**  
**Does this package cause this exception? is there any solution to resolve this issue?****
Developer technologies .NET .NET MAUI
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 50,126 Reputation points Microsoft External Staff
    2024-11-07T06:37:14.52+00:00

    Hello,

    Thanks for your feedback.

    After testing, in .net maui 8.0, the following Nuget Packages combinations compile correctly without any error message.

    <ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
    <PackageReference Include="Xamarin.Android.Google.BillingClient" Version="7.1.1" />
     
    	<PackageReference Include="Xamarin.AndroidX.Fragment.Ktx" Version="1.8.3.1" />
     
    	<PackageReference Include="Xamarin.GooglePlayServices.Base" Version="118.5.0.2" />
    </ItemGroup>
    

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.