Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How to use Design Support Library and Xamarin.Auth together?

TedRogersTedRogers USMember ✭✭✭✭

If I add the Xamarin.Android.Support.Design package to my project and then add the Xamarin.Auth package to my project I cannot build. I get an error that Fragment is defined in both Xamarin.Android.Support.Fragment and Xamarin.Android.Support.v4. How do I resolve this issue?

Best Answers

Answers

  • TedRogersTedRogers USMember ✭✭✭✭

    Added example project that I quickly hacked together to illustrate the build problem.

  • TedRogersTedRogers USMember ✭✭✭✭

    Anybody have any ideas on this? It may be something simple, I just don't know what that simple is.

  • cwphillicwphilli USMember ✭✭✭

    In your project references, view properties on the Xamarin.Android.Support.Fragment.
    Under aliases, change from global to something else, i.e. DesignLibraryAndAuthIssue.

    To use one or the other in a code file you'd need to use the extern keyword with alias and the named alias to change the root namespace for the types you're using.
    extern alias DesignLibraryAndAuthIssue;

    I had to make a few other changes to compile your sample project successfully.

    • Added PCLCrypto to the project
    • The following Support Library references had a version mismatch from the rest of them:
      • The majority were v4.0.30319
      • The following were v2.0.50727
        • Xamarin.Android.Support.CustomTabs
        • Xamarin.Android.Support.V4

    I upgraded all of them to v4.0.30319.

  • TedRogersTedRogers USMember ✭✭✭✭
    Accepted Answer

    @cwphilli thanks. When you say you upgraded all of them to v4.0.30319, how do you do that? I believe those older version got pulled in by the Xamarin.Auth package.

  • cwphillicwphilli USMember ✭✭✭

    You can probably more easily do the same via nuget package manager - manage packages for solution GUI under Updates

  • moljacmoljac HRBeta ✭✭✭

    @TedRogers

    If you are using Visual Studio (2017 and 2015 for sure) there is neat option: "Consolidate Packages". Try consolidating all, but those for Xamarin.Forms. Namely Xamarin.Forms are pinned to Xamarin.Android.Support version[s].

    Since Xamarin.Forms support was added to Xamarin.Auth, yes there are a lot of problems with getting nuget packages to play together, but it is doable.

Sign In or Register to comment.