Sometimes a sketch will not compile and the messages warn that several libraries are available for XXXXX.h. The IDE then goes on to say which library it has used and which one(s) it hasn't used, as shown below:
Mehrere Bibliotheken wurden für "BLEDevice.h" gefunden
Benutzt:~/Arduino/libraries/ArduinoBLE
Nicht benutzt:~/.arduino15/packages/m5stack/hardware/esp32/2.0.7/libraries/BLE
Sometimes both libraries are required, for different boards for example. How can one specify which library the sketch should use. For instance in the example above the sketch is loading the wrong one.
If you open the directory ~/.arduino15/packages/m5stack/hardware/esp32/2.0.7/libraries/BLE in your file manager, I imagine there is a subfolder named "src".
When you give the absolute path, you need to remember the src subfolder.
In Linux systems it is shorhand for the path to the users directory. But as I wrote above I removed the "~" and wrote the full path but it still didn't compile.
I'm thinking that with different libraries for different boards, that some compiler directives should work. I have very basic knowledge here, but perhaps something with #ifdev. There are sketches that will demonstrate this.