Repository navigation
Fix duplicate class errors for runtime-annotation-jvm and datastore-preferences-core-jvm - #1371
Merged
Merged
Conversation
…references-core-jvm (#1341) Exclude JVM variant packages as runtime dependencies from their parent no-bindings packages to prevent duplicate class errors (JAVA0000) when R8/D8 code shrinker is enabled in Android/MAUI projects. - Xamarin.AndroidX.Compose.Runtime.Annotation (1.10.3.1): exclude androidx.compose.runtime.runtime-annotation-jvm as runtime dependency - Xamarin.AndroidX.DataStore.Preferences.Core (1.2.0.2): exclude androidx.datastore.datastore-preferences-core-jvm as runtime dependency The Maven POMs declare the JVM variant as a compile-scope dependency of the parent artifact. The binderator was converting this into a NuGet PackageReference, causing both the Android (.aar) and JVM (.jar) variants to be included simultaneously, leading to: 'Type androidx.compose.runtime.Immutable is defined multiple times' 'Type androidx.compose.runtime.StableMarker is defined multiple times' 'Type androidx.datastore.preferences.core.AtomicBoolean is defined multiple times' Fixes #1341
There was a problem hiding this comment.
Pull request overview
Adjusts binderator configuration to prevent JVM-variant artifacts from being pulled into Android builds as transitive NuGet dependencies, avoiding R8/D8 duplicate-class failures (notably for Compose runtime-annotation and DataStore datastore-preferences-core) as reported in #1341.
Changes:
- Add
excludedRuntimeDependenciesrules to drop*-jvmartifacts from the parent packages’ runtime dependency lists. - Bump NuGet revisions for the affected parent packages to ship the dependency-graph fix.
- Update component governance manifest and the artifact/version documentation to reflect the new NuGet versions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| docs/artifact-list-with-versions.md | Updates the published NuGet versions for the parent artifacts to reflect the revision bump. |
| config.json | Adds excludedRuntimeDependencies for the JVM variants and bumps nugetVersion revisions for the affected packages. |
| cgmanifest.json | Updates tracked NuGet versions for component governance to match the new package revisions. |
moljac
approved these changes
Feb 28, 2026
jonathanpeppers
approved these changes
Mar 2, 2026
MartinZikmund
added a commit
to unoplatform/uno.templates
that referenced
this pull request
May 12, 2026
AppCompat 1.7.1.2 transitively pulls Compose.Runtime.Annotation 1.10.0.1, which depends on both the .Android (AAR) and .Jvm (JAR) variants and triggers an R8 duplicate-class error for androidx.compose.runtime.Immutable on Android builds. AppCompat 1.7.1.3 pulls Compose.Runtime.Annotation 1.10.4.1 transitively, which contains the upstream fix (dotnet/android-libraries#1371) excluding the JVM variant from Android targets. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
MartinZikmund
added a commit
to unoplatform/uno
that referenced
this pull request
May 12, 2026
AppCompat 1.7.1.2 transitively pulls Compose.Runtime.Annotation 1.10.0.1, which depends on both the .Android (AAR) and .Jvm (JAR) variants and triggers an R8 duplicate-class error for androidx.compose.runtime.Immutable on Android builds: java error JAVA0000: Type androidx.compose.runtime.Immutable is defined multiple times: xamarin.androidx.compose.runtime.annotation.android ... xamarin.androidx.compose.runtime.annotation.jvm ... AppCompat 1.7.1.3 pulls Compose.Runtime.Annotation 1.10.4.1 transitively, which contains the upstream fix (dotnet/android-libraries#1371) excluding the JVM variant from Android targets. Also bumps AndroidXActivity in Uno.Sdk/packages.json to 1.12.4.1 (matching uno.templates) since AppCompat 1.7.1.3 transitively requires Activity >= 1.12.4.1 - keeping the older pin would trigger NU1605 for downstream Uno.Sdk consumers. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
MartinZikmund
added a commit
to unoplatform/uno
that referenced
this pull request
May 12, 2026
Match the AppCompat version already pinned in Directory.Build.targets and Uno.Sdk/packages.json so consumers restoring Uno.WinUI get the same AndroidX binding surface (Compose.Runtime.Annotation 1.10.4.1, which contains the upstream fix from dotnet/android-libraries#1371). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
MartinZikmund
added a commit
to unoplatform/uno.templates
that referenced
this pull request
May 13, 2026
AppCompat 1.7.1.2 transitively pulls Compose.Runtime.Annotation 1.10.0.1, which depends on both the .Android (AAR) and .Jvm (JAR) variants and triggers an R8 duplicate-class error for androidx.compose.runtime.Immutable on Android builds. AppCompat 1.7.1.3 pulls Compose.Runtime.Annotation 1.10.4.1 transitively, which contains the upstream fix (dotnet/android-libraries#1371) excluding the JVM variant from Android targets. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
MartinZikmund
added a commit
to unoplatform/uno.templates
that referenced
this pull request
May 13, 2026
AppCompat 1.7.1.2 transitively pulls Compose.Runtime.Annotation 1.10.0.1, which depends on both the .Android (AAR) and .Jvm (JAR) variants and triggers an R8 duplicate-class error for androidx.compose.runtime.Immutable on Android builds. AppCompat 1.7.1.3 pulls Compose.Runtime.Annotation 1.10.4.1 transitively, which contains the upstream fix (dotnet/android-libraries#1371) excluding the JVM variant from Android targets. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
MartinZikmund
added a commit
to unoplatform/uno.templates
that referenced
this pull request
May 13, 2026
AppCompat 1.7.1.2 transitively pulls Compose.Runtime.Annotation 1.10.0.1, which depends on both the .Android (AAR) and .Jvm (JAR) variants and triggers an R8 duplicate-class error for androidx.compose.runtime.Immutable on Android builds. AppCompat 1.7.1.3 pulls Compose.Runtime.Annotation 1.10.4.1 transitively, which contains the upstream fix (dotnet/android-libraries#1371) excluding the JVM variant from Android targets. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
MartinZikmund
added a commit
to unoplatform/uno
that referenced
this pull request
May 28, 2026
AppCompat 1.7.1.2 transitively pulls Compose.Runtime.Annotation 1.10.0.1, which depends on both the .Android (AAR) and .Jvm (JAR) variants and triggers an R8 duplicate-class error for androidx.compose.runtime.Immutable on Android builds: java error JAVA0000: Type androidx.compose.runtime.Immutable is defined multiple times: xamarin.androidx.compose.runtime.annotation.android ... xamarin.androidx.compose.runtime.annotation.jvm ... AppCompat 1.7.1.3 pulls Compose.Runtime.Annotation 1.10.4.1 transitively, which contains the upstream fix (dotnet/android-libraries#1371) excluding the JVM variant from Android targets. Also bumps AndroidXActivity in Uno.Sdk/packages.json to 1.12.4.1 (matching uno.templates) since AppCompat 1.7.1.3 transitively requires Activity >= 1.12.4.1 - keeping the older pin would trigger NU1605 for downstream Uno.Sdk consumers. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
MartinZikmund
added a commit
to unoplatform/uno
that referenced
this pull request
May 28, 2026
Match the AppCompat version already pinned in Directory.Build.targets and Uno.Sdk/packages.json so consumers restoring Uno.WinUI get the same AndroidX binding surface (Compose.Runtime.Annotation 1.10.4.1, which contains the upstream fix from dotnet/android-libraries#1371). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
When R8/D8 code shrinker is enabled in Android/MAUI projects, the build fails with:
JAVA0000: Type androidx.compose.runtime.Immutable is defined multiple times:
xamarin.androidx.compose.runtime.annotation.android
xamarin.androidx.compose.runtime.annotation.jvm
JAVA0000: Type androidx.datastore.preferences.core.AtomicBoolean is defined multiple times
Root cause:
The Maven POMs for runtime-annotation and datastore-preferences-core declare their JVM variants as compile-scope dependencies. The binderator converts these into NuGet PackageReferences, causing both the Android (.aar) and JVM (.jar) variants to be pulled in simultaneously. R8/D8 then fails because the same Java classes exist in both.
Fix:
Added excludedRuntimeDependencies to prevent the JVM variant packages from being generated as NuGet dependencies of their parent packages.
The Android (.aar) variant already contains all the necessary classes for Android builds. The JVM (.jar). variant is redundant on Android and causes the duplicate class conflict.
Impact
Users who previously needed to workaround this with:
will no longer need this workaround after upgrading to the new package versions.
Fixes #1341