polarofficial / polar-ble-sdk

Repository includes SDK and code examples. More info https://polar.com/en/developers
Other
475 stars 153 forks source link

SDK Library Bindings for Xamarin Android #339

Closed Stride9Dev closed 11 months ago

Stride9Dev commented 1 year ago

Platform your question concerns:

Device:

Description: I followed @tessarolli's post https://github.com/polarofficial/polar-ble-sdk/issues/56 to get an android native lib into an Xamarin Forms solution. I seem to be able to get the binding to work, though when calling PolarBleApiDefaultImpl.DefaultImplementation(), it crashes with this exception:

Java.Lang.VerifyError: 'Verifier rejected class com.polar.androidcommunications.enpoints.ble.bluedroid.host.BDDeviceListenerImpl: io.reactivex.rxjava3.core.Observable com.polar.androidcommunications.enpoints.ble.bluedroid.host.BDDeviceListenerImpl.monitorDeviceSessionState() failed to verify: io.reactivex.rxjava3.core.Observable com.polar.androidcommunications.enpoints.ble.bluedroid.host.BDDeviceListenerImpl.monitorDeviceSessionState(): [0x2] can't resolve returned type 'Unresolved Reference: io.reactivex.rxjava3.core.Observable' or 'Unresolved Reference: io.reactivex.rxjava3.subjects.BehaviorSubject' (declaration of 'com.polar.androidcommunications.enpoints.ble.bluedroid.host.BDDeviceListenerImpl' appears in /data/app/~~-C7FxCvhIscj7dh0FY5LqQ==/com.companyname.hrm-czy1GKioidpyr_vjb12I-A==/base.apk)'

Anyone else run into this problem?

Should it matter, the Xamarin project references these two Naxam packages:

<PackageReference Include="Naxam.RxJava2.Droid" Version="2.1.2" /> <PackageReference Include="Naxam.ReactiveStreams.Droid" Version="1.0.1" />

And I compiled the polar-ble-sdk-4.0.0 project, which has these two dependencies: implementation 'io.reactivex.rxjava3:rxandroid:3.0.0' implementation 'io.reactivex.rxjava3:rxjava:3.1.5'

samulimaa commented 11 months ago

Hello,

I think that the cause of that error is mismatch between RxJava versions. Try to replace Naxam.RxJava2.Droid with Naxam.RxJava3.Droid and update your code to use RxJava3 classes and methods.