Comments (8)
What kind of the device are you trying to connect to ?
Take a look at this README section :
https://github.com/OmarAflak/Bluetooth-Library/blob/master/README.md#connect-to-device-using-port-trick
from bluetooth-library.
I'm trying to connect from an Android 9.0 Samsung device to a Windows 10 PC with a bluetooth dongle.
I have also tried to connect with the port tricking but no success.
from bluetooth-library.
I get this error:
W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'android.bluetooth.BluetoothSocket android.bluetooth.BluetoothDevice.createRfcommSocketToServiceRecord(java.util.UUID)' on a null object reference
at me.aflak.bluetooth.Bluetooth.connect(Bluetooth.java:462)
W/System.err: at me.aflak.bluetooth.Bluetooth.connectToDevice(Bluetooth.java:271)
at me.aflak.bluetooth.Bluetooth.connectToDevice(Bluetooth.java:279)
W/System.err: at com.sontme.esp.getlocation.activities.MainActivity$3$2.onDiscoveryFinished(MainActivity.java:363)
at me.aflak.bluetooth.Bluetooth$7$3.run(Bluetooth.java:597)
at me.aflak.bluetooth.utils.ThreadHelper.run(ThreadHelper.java:15)
W/System.err: at me.aflak.bluetooth.Bluetooth$7.onReceive(Bluetooth.java:594)
at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1486)
at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:873)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7073)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
from bluetooth-library.
I'm having the same error, using either connectToDevice
and connectToDeviceWithPortTrick
, but fails every time.
I downloaded the Bluetooth Terminal app and it logs the same error on the screen.
I tried to connect from a Pixel 3 (Android 10) to a Galaxy J5 Pro (Android 9).
from bluetooth-library.
yep, same for me, trying to connect to medical device, but it is saying same, error_read failed, socket might closed or timeout, read ret: -1
from bluetooth-library.
Please make sure you are using a regular Bluetooth dongle, not BLE. BLE is not supported.
from bluetooth-library.
I'm getting this msg too. Is there any solution? Is there any way to disable BLE @omaraflak?
from bluetooth-library.
This issue is still persistent, is there a workaround for this, none of the other libraries are also able to tackle this.
from bluetooth-library.
Related Issues (20)
- Attempt to invoke virtual method 'android.bluetooth.BluetoothSocket me.aflak.bluetooth.Bluetooth$ReceiveThread.getSocket()' on a null object reference HOT 3
- String Translate ... HOT 2
- Multiple Bluetooth Client Connections HOT 1
- AutoConnect Error HOT 1
- Allow sending and receiving data (bytes) without with use of CR LF delimiters HOT 3
- NullPointerException when starting another activity HOT 3
- Add support for PIN HOT 2
- Multiple Clients. HOT 1
- About scanning the nearby bluetooth device HOT 7
- How to set baudrate? HOT 1
- onMessage method is not calling after device sending data to application HOT 2
- Android 9 device not visible in scan HOT 1
- Cannot connect after close an activity and reopen again. HOT 1
- Can not terminate socket on activity close. HOT 2
- startDiscovery impossible HOT 7
- Connected but chat not working HOT 1
- Connected but chat not working HOT 2
- SocketReader read() returning null HOT 2
- Android Bluetooth Classic RFCOMM connection failing, getUUIDs() returns no SPP UUID HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bluetooth-library.