Building a Bindings Library

I am building a Bindings Library to make use of a 3rd party SDK. I've referenced the AAR and all the JAR files that Gradle pulls when it syncs.

I get no errors, but the resulting DLL only contains about half the classes contained in the SDK.

I'm assuming the next step is to look at the warnings, but there are more than 300 of them, and I don't know which are important, which are preventing the classes from appearing in the DLL, or which ones are trivial.

I've started focusing on warnings that contain the phrase "missing class error", because I'm assuming those are missing dependencies, but I don't know if I'm heading down the right path. The first "missing class error" warning pertains to a JAR that I'm already referencing, so I don't know why the binder is not resolving that reference.

I guess my questions are the following:

  1. How do I know which warnings are important?
  2. Should "missing class error" warnings not be errors? It's preventing the creation of a complete binding library I think?
  3. Is there a way to get more verbose build outputs from the binder, so I can see why it is not finding a class in a JAR that is already referenced?
  4. There are also a few messages saying that "This class is obsoleted in this android platform". Can I override that behavior to include even obsolete classes, or has it got more to do with the platform that I'm targeting.
  5. Is there a in-depth tutorial on creating a Binding Library? The main Xamarin page on the topic just scratches the surface (https://developer.xamarin.com/guides/android/advanced_topics/binding-a-java-library/). The best resource for debugging I've found is on Github: https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb

Thank you

Answers

  • BillHolmesBillHolmes USXamarin Team Xamurai

    Which library are you attempting to bind? It may be one I have seen.

    You are correct to assume that the warnings are telling you which classes can not be loaded. This can be because of a missing reference jar file in your binding project. I realize that you feel that you have them all, but do double check. Many things depend on the Android Support libraries and you will need to add the Support NuGets to your binding project.

    Next there are 2 jar parsers available now. jar2xml and class-parse. I believe that the older jar2xml is still the default. You can switch to class-parse by adding a property node to your binding csproj file.

Sign In or Register to comment.