Forum Xamarin.Forms

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Managing dependencies of a external SDK

Hi!

I've started a process of building a java binding on top of a SDK provided for us by one of our partners. I'm struggling a bit but little by little I'm managing to make progress. However, the point of this post is not the java binding, but one curious fact that made me wonder about managing dependencies of a SDK, be it one provided for us or one that we have to build ourselves.

The curious fact is: I'm having to import some dependencies that are specific for Android on the front-end application that is consuming the SDK. Why is this happening? For example, in order to run a method from the SDK, the compiler (Visual Studio) asks me to import GoogleGson, Kotlin, Koin, etc. Which are dependencies specific for Android. Shouldn't the SDK wrap them within itself without forcing the application to import them as well? If that situation is to be expected, why does that happen?

I'm pretty sure this is something more in line with the concept of managing dependencies than Java Bindings specifically, which is why I'm posting here. Any light on this subject would be really appreciated.

Best Answer

  • LandLuLandLu Member, Xamarin Team Xamurai
    Accepted Answer

    It depends on the framework you are using.
    If it hasn't referenced the corresponding package in its dependencies then you need to add it manually in your own project.
    i.e. For Xamarin.Essentials:
    https://github.com/xamarin/Essentials/blob/master/Xamarin.Essentials/Xamarin.Essentials.csproj
    It referenced the other packages it needed.
    Moreover, if a library has been uploaded to the nuget then the nuspec file should point out all the dependencies of the package. Then the nuget will help you automatically install those dependent packages.

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai
    Accepted Answer

    It depends on the framework you are using.
    If it hasn't referenced the corresponding package in its dependencies then you need to add it manually in your own project.
    i.e. For Xamarin.Essentials:
    https://github.com/xamarin/Essentials/blob/master/Xamarin.Essentials/Xamarin.Essentials.csproj
    It referenced the other packages it needed.
    Moreover, if a library has been uploaded to the nuget then the nuspec file should point out all the dependencies of the package. Then the nuget will help you automatically install those dependent packages.

  • RaelsonCraftzRaelsonCraftz BRMember ✭✭

    I see. I think I got too comfortable with nuget managing everything and didn't pay attention to what was going on. Now that I'm having to work out most of the dependencies for Java Binding, many references I have to add manually. Thank you for the input, confirming this helps me a lot.

Sign In or Register to comment.