don / cordova-plugin-ble-central

Bluetooth Low Energy (BLE) Central plugin for Apache Cordova (aka PhoneGap)
Apache License 2.0
942 stars 603 forks source link

Problem with RequiresPermission dependency in Capacitor 3 #957

Closed sdunnin closed 1 year ago

sdunnin commented 1 year ago

I am using the ble-central plugin in a Capacitor application. After upgrading from 1.4.x. to latest 1.6.3 when building the app in Android Studio it complained about not being able to resolve androidx.annotation.RequiresPermission which was a result of a missing dependency implementation "androidx.annotation:annotation:1.1.0" in build.gradle. Adding the dep then made the project build successfully.

Problem was that whenever a Capacitor Update cli command was run the generated build.gradle would be overwritten. To solve the issue I hacked the following into plugin.xml for my installed version of the plugin which the Capacitor cli subsequently adds the dependency into build.gradle.

<framework src="androidx.annotation:annotation:1.1.0"/>

I'm guessing this is probably more of a Capacitor tooling issue as I'm not really sure how this would be handled in other frameworks that utilize ble-central. Wanted to at least document this for others that may come across this issue using the plugin.

peitschie commented 1 year ago

@sdunnin thanks for sharing! What version of capacitor are you working with? I might see if the above tweak has any ill-effects with any other configurations... it may be worth just doing, otherwise.

sdunnin commented 1 year ago

We are using Capacitor 3.3

peitschie commented 1 year ago

I'll close this as Capacitor 5 has just been released. If there's significant interest in this however, please re-open and I can have a look at addressing it.