1

I get some error messages when trying to bind the aar file containing the nordic dfu lib for android.

BINDINGSGENERATOR : warning BG8604: top ancestor DfuBaseService not found for nested type NO.Nordicsemi.Android.Dfu.DfuBaseService.1. BINDINGSGENERATOR : warning BG8604: top ancestor DfuBaseService not found for nested type NO.Nordicsemi.Android.Dfu.DfuBaseService.2. BINDINGSGENERATOR : warning BG8604: top ancestor DfuBaseService not found for nested type NO.Nordicsemi.Android.Dfu.DfuBaseService.3. BINDINGSGENERATOR : warning BG8604: top ancestor DfuBaseService not found for nested type NO.Nordicsemi.Android.Dfu.DfuBaseService.4. BINDINGSGENERATOR : warning BG8604: top ancestor DfuBaseService not found for nested type NO.Nordicsemi.Android.Dfu.DfuBaseService.5.

This is the class declaration in the source code:

public abstract class DfuBaseService extends IntentService implements DfuProgressInfo.ProgressListener {}

I tried adding this to metadata.xml:

<attr path="/api/package[@name='no.nordicsemi.android.dfu']/class[@name='DfuBaseService']" name="extends">mono.android.app.IntentService</attr>

But then I get an additional error:

BINDINGSGENERATOR : /Users/laerdaldeveloper/Projects/NordicDfuPlayground/NordicDfuPlayground/Transforms/Metadata.xml(11, 6) warning BG8A04: matched no nodes.

This is extra frustrating since I managed to bind this library one year ago :( Any tips as to what I might try?

P.S. I also tried making this class public before compiling the aar, but did not help(I added an empty class also, to verify I got changes bound)

Tompi
  • 218
  • 2
  • 10

1 Answers1

0

I figured this one out by looking a bit closer on https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb

Default in vs(at least on mac) seems to be "class-parse", which didnt give much sensible errors in this case(that I found at least). Once I switched to jar2xml:

<AndroidClassParser>jar2xml</AndroidClassParser>

I got this error:

JARTOXML : warning J2XA006: missing class error was raised while reflecting no.nordicsemi.android.dfu.DfuBaseService : android/support/v4/app/NotificationCompat$Builder

So I just needed to add Xamarin.Android.Support.v4, and also fix this, https://github.com/xamarin/AndroidSupportComponents/issues/124#issuecomment-440782832 and then it worked...

Tompi
  • 218
  • 2
  • 10
  • Glad the gist helped out! It's definitely worth filing an issue over at https://github.com/xamarin/xamarin-android regarding the warnings/errors not showing in `class-parse`. – Jon Douglas Dec 20 '18 at 16:15
  • @Tompi I am currently running into the exact same issue. I tried your solution but the error is still the same. Do you have a sample project for this binding somewhere? – Saad Feb 17 '20 at 13:23
  • @JonDouglas sorry about the late reply, but I finally got the OK to open source our binding library, the plan is to make a nuget of this, but for now, check out https://github.com/Laerdal/Xamarin.Nordic.DFU.Android (This is for the latest version of the lib, so it uses androidx, NOT the support libraries) – Tompi Apr 10 '20 at 09:08