Skip to content

Google Play Age Signals – R8 Duplicate Class Errors (androidx.tracing + androidx.savedstate) in Xamarin/Android Binding #1332

Open

Description

@kk25maj

Description

We are integrating the Google Play Age Signals API (package: com.google.android.play:age-signals) using the official Xamarin binding package ‘Xamarin.Google.Android.Play.Age.Signals (0.0.1-beta02)’.

During R8/D8 compilation, the build fails with duplicate class errors:

Duplicate class: androidx.tracing.TraceKt$traceAsync$1 - tracing-android.aar - tracing-ktx.aar

Duplicate class: androidx.savedstate.ViewKt - savedstate-android.aar - savedstate-ktx.aar

This occurs even when:

Explicitly pinning AndroidX versions
Excluding tracing/savedstate dependencies
Adding ProGuard rules
Using in NuGet
The issue appears to originate from the Age Signals AAR pulling mismatched AndroidX dependencies (ktx + non-ktx) that produce conflicting classes.

We cannot integrate Age Signals into production until this is resolved.

Request:

Please verify the dependency structure for com.google.android.play:age-signals
Update the AAR to depend consistently on either android or ktx variants
Provide guidance for R8/D8 linking with Age Signals
Environment:

.NET 9 Android
R8 8.7.x
Xamarin.AndroidX.* stable versions
Xamarin.Google.Android.Play.Age.Signals 0.0.1-beta02
Thank you.

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

10.0.20

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

Activity

  1. transferred this issue fromdotnet/mauion Dec 11, 2025
  2. jonathanpeppers commented on Dec 12, 2025

    @jonathanpeppers
    Member

    This is probably duplicate of:

    Can you share a sample project with this problem?

    The fix is to update various packages to latest and the problem will go away.

  3. cnkHomero commented on Dec 15, 2025

    @cnkHomero

    @jonathanpeppers I'm encourntering the same issue. I've attached a simple .Net MAUI project for Android / iOS & added a reference to 'Xamarin.Google.Android.Play.Age.Signals'. You should be able to reproduce by targeting the Android platform and attempting to compile.

    MauiAVApp.zip

  4. kk25maj commented on Dec 17, 2025

    @kk25maj
    Author

    exactly same issue .. as in attached zip file

    is this solution ?

    #764

  5. moljac commented on Dec 18, 2025

    @moljac
    Contributor

    is this solution ?

    #764

    Yes. That issue is there to give users feeling what needs to be done.

  6. kk25maj commented on Dec 19, 2025

    @kk25maj
    Author

    THANKS jonathanpeppers
    HVALA MOLJAC !!!!!!

    Solved – R8/D8 duplicate class errors with Age Signals

    We hit R8/D8 errors like:

    Duplicate class androidx.tracing.TraceKt$traceAsync$1

    Duplicate class androidx.savedstate.ViewKt

    when integrating Xamarin.Google.Android.Play.Age.Signals (0.0.1) on .NET 9 Android.

    Root cause:
    Mismatched AndroidX *-android vs *-ktx package versions pulled transitively by Age Signals, resulting in the same classes being packaged twice.

    How we fixed it:

    Ran:

    dotnet list package --include-transitive

    and found version mismatches:

    Tracing.Android 1.3.0.1 vs Tracing.Ktx 1.2.0.11

    SavedState.Android 1.3.1.1 vs SavedState.Ktx 1.2.1.17

    Explicitly pinned the KTX packages to match the Android ones in the Android project .csproj:

    PackageReference Include="Xamarin.AndroidX.Tracing.Tracing.Ktx" Version="1.3.0.1"
    PackageReference Include="Xamarin.AndroidX.SavedState.SavedState.Ktx" Version="1.3.1.1"

    Deleted bin/ and obj/, then ran:

    dotnet restore
    dotnet build -c Release

    Result:
    Release build succeeds, R8/D8 duplicate class errors are gone, Age Signals works correctly.

    This matches the known AndroidX “type defined multiple times” issue caused by version misalignment between android and ktx artifacts.

  7. kk25maj commented on Dec 19, 2025

    @kk25maj
    Author
    PackageReference Include="Xamarin.AndroidX.Tracing.Tracing.Ktx" Version="1.3.0.1"
    PackageReference Include="Xamarin.AndroidX.SavedState.SavedState.Ktx" Version="1.3.1.1"
    
  8. moljac commented on Dec 19, 2025

    @moljac
    Contributor

    HVALA MOLJAC !!!!!!

    Nema na cemu!

  9. moljac commented on Jan 5, 2026

    @moljac
    Contributor

    exactly same issue .. as in attached zip file

    is this solution ?

    #764

    This is not direct solution, but bunch of samples to get idea what is going on. Libraries are living ecosystem and they change. Google moves types around, modifies libraries and that causes problems.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions