Recommended approach to porting an Android library (AAR) with many dependencies

I have a feature-rich (uses database, networking, threading, etc) Android SDK (bundled as an AAR) that I am trying to create a Xamarin bindings library for. There are several dependencies, some of which have their own dependency subtree.

It seems that the way to do this port would be to:

  • create a Xamarin bindings library for each direct dependency of the AAR

  • in each of these binding projects, add all transitive dependencies of the direct dependency as reference Jars

  • fix all the build errors (for example CollectionTypeAdapterFactory.Adapter' does not implement inherited abstract member 'TypeAdapter.Read(JsonReader)) one by one by editing a set of transformation rules in the Xamarin manifest.xml file

Is this correct? I understand this might be about as easy / automated as things get for the task of porting Java to C#, but it's also a bit of an undertaking so I wanted a bit of input to make sure I didn't miss anything. This should also hopefully help other people who are looking into how to solve this problem, as I couldn't find many definitive answers.

Answers

  • JonDouglasJonDouglas USXamarin Team, University, Developer Group Leader Xamurai

    It's typically best to create a bindings library for each .aar. That is, if you have multiple. This way you have a better structure of maintaining the library in the future and standalone pieces can be used for other bindings as well.

Sign In or Register to comment.