3

I am Working on BLE project on Xamarin. Currently I am working on the Over-The-Air Device Firmware Upgrade (OTA-DFU) part. I am planing to use the native java Android DFU Library on Xamarin.

I am following the documentation on binding Java library to Xamarin.

In the end the compiler displays Warning BG8102: Class NO.Nordicsemi.Android.Dfu.DfuBaseService has unknown base type android.app.IntentService. (BG8102) (AndroidDUFLibrary). I was enable to reference the converted java library in Xamarin. But some class are missing and I cannot reference it.

Could you please let me know how can I fix the missing class issues?

ding
  • 278
  • 4
  • 13

2 Answers2

2

I have found this post. The missing class issue was fixed when I manually add the IntentService source code to my project (create new IntentService file and paste the IntentService source code) and made custom package name inside the IntentService source code (e.g. com.mynewpackage). Then I replace the IntentService as com.mynewpackage.IntentService everywhere in my project.

It's kind of ugly solution. We have to manually add source code files for the missing classes one by one in the project. It would be better to change some configuration in the compiler to automatically fix the missing class issue.

Community
  • 1
  • 1
ding
  • 278
  • 4
  • 13
2

I know this is a bit old, but in case someone else is searching for this, another solution I found is to simply reference the Xamarin component of the IntentService by modifying the Metadata.xml file.

<attr path="api/package[@name='The.Package.Here']/class[@name='TheClassHere']" name="extends">mono.android.app.Intentservice</attr>

That way there is no need to manually add the source code like the solution posted before.