Search code examples
c#xamarinxamarin.androidestimotebeacon

How to build Xamarin Binding Library for estimote-sdk.aar


I would like to use the Estimote Beacon SDK in an Xamarin for Android Application. Since Xamarin's Estimote SDK [1] is very much outdated, I was thinking of including the official Estimote SDK [2] into the project which provides an estimote-sdk.aar file which I was trying to include and use. The Xamarin documentation suggests creating a Binding Library for that purpose [3].

So I was following those steps, made a Binding Library, added the .aar and set it's Build Action to LibraryProjectZip but I get several errors:

While I can solve the errors like

member names cannot be the same as their enclosing type

by renaming the members via Metadata.xml like so:

<attr path="/api/package[@name='com.estimote.sdk.cloud.model.google']/class[@name='Beacons']/field[@name='beacons']" name="name">BeaconsList</attr>

I don't know how to solve erros like

"Buffer" does not implement interface member "IBufferedSink.Buffer()"

How can this be solved?
What is the best approach to include the Estimote SDK into a Xamarin for Android application?

[1] Estimote SDK for Android by Xamarin Inc. https://components.xamarin.com/view/estimotesdkandroid
[2] Official Estimote SDK for Android https://github.com/Estimote/Android-SDK
[3] Binding an .AAR in Xamarin Developer portal https://developer.xamarin.com/guides/android/advanced_topics/binding-a-java-library/binding-an-aar/


Solution

  • Your best bet to support the Estimote SDK is to do the binding yourself. We do have a components team who tries to stay on top of every release, but as there are so many new releases and new libraries coming out everyday. It can serve quite a challenge.

    1. "Buffer" does not implement interface member "IBufferedSink.Buffer()"

    This typically means that the class is not implementing the respective interface member. You have a couple ways to go around this error.

    1. Create a Partial class of your offending class and implement the interface member.

    2. Look at the api.xml to ensure the class is implementing all members of the interface. Have a check at all the return types / arguments / etc to ensure they match the proper types. You would then have to change the managedReturn, managedType, or propertyName via Metadata.xml.

    As a general reference, I have a small binding guide that you can find here:

    https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb

    Specifically you might be most interested in common metadata fixes: https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb#common-metadata-fixes