Tompi
Tompi

Reputation: 296

Xamarin binding of Nordic Dfu library

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)

Upvotes: 1

Views: 595

Answers (1)

Tompi
Tompi

Reputation: 296

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...

Upvotes: 0

Related Questions