java.io.IOException: Bluetooth not initialized

44 views
Skip to first unread message

Gareth Murfin

unread,
Aug 27, 2019, 7:25:12 PM8/27/19
to CodenameOne Discussions
Getting this error with the bluetooth lib on Android (samsung s7 -  Android 8.0)

W/System.err: java.io.IOException: Bluetooth not initialized
W/System.err:     at com.codename1.cordova.Cordova.execute(Cordova.java:33)
W/System.err:     at com.codename1.bluetoothle.Bluetooth.enable(Bluetooth.java:85)
W/System.err:     at userclasses.MainForm.startBluetooth(MainForm.java:55)
W/System.err:     at com.pippa.hobmonitor.MyApplication.start(MyApplication.java:41)
W/System.err:     at com.pippa.hobmonitor.MyApplicationStub.run(MyApplicationStub.java:163)
W/System.err:     at com.pippa.hobmonitor.MyApplicationStub$1.run(MyApplicationStub.java:107)
W/System.err:     at com.codename1.ui.Display.processSerialCalls(Display.java:1298)
W/System.err:     at com.codename1.ui.Display.mainEDTLoop(Display.java:1093)
W/System.err:     at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
W/System.err:     at com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
W/System.err:     at java.lang.Thread.run(Thread.java:764)

Gareth Murfin

unread,
Aug 27, 2019, 7:33:38 PM8/27/19
to CodenameOne Discussions
seems to be related to the json lib not working .. any ideas?

 Exception: java.lang.NoSuchMethodError - No direct method <init>(Ljava/util/Map;)V in class Lca/weblite/codename1/json/JSONObject; or its super classes (declaration of 'ca.weblite.codename1.json.JSONObject' appears in /data/app/com.pippa.hobmonitor-i555BGum4BjW27o1gIXtCQ==/base.apk)
W/System.err: java.lang.NoSuchMethodError: No direct method <init>(Ljava/util/Map;)V in class Lca/weblite/codename1/json/JSONObject; or its super classes (declaration of 'ca.weblite.codename1.json.JSONObject' appears in /data/app/com.pippa.hobmonitor-i555BGum4BjW27o1gIXtCQ==/base.apk)

Shai Almog

unread,
Aug 28, 2019, 1:11:01 AM8/28/19
to CodenameOne Discussions
Did you install the dependencies?

Gareth Murfin

unread,
Aug 28, 2019, 9:21:52 AM8/28/19
to CodenameOne Discussions
well I think so.. my libs dir is shown below, anything else required?

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       28/08/2019     14:03                impl
-a----       27/08/2019     20:46        2264815 CLDC11.jar
-a----       27/08/2019     21:46          50396 CN1Bluethooth.cn1lib
-a----       14/08/2017     10:44          30533 CN1JSON.cn1lib
-a----       27/08/2019     21:19        6256001 CodenameOne.jar
-a----       27/08/2019     21:19       10888836 CodenameOne_SRC.zip

Kandy Bitxenio

unread,
Aug 28, 2019, 9:25:43 AM8/28/19
to CodenameOne Discussions
If you I can send you my libraries, or my dummy project.

Best Regards.

Gareth Murfin

unread,
Aug 28, 2019, 9:37:51 AM8/28/19
to CodenameOne Discussions
That would be great Kandy, a dummy project that you know works would help me greatly. I appreciate your help!

Kandy Bitxenio

unread,
Aug 28, 2019, 9:56:30 AM8/28/19
to CodenameOne Discussions
Hi Gareth

This are my libs, please give me your mail to send the project.


My project is copied from:


Best Regards

Gareth Murfin

unread,
Aug 28, 2019, 10:30:04 AM8/28/19
to CodenameOne Discussions
Thanks very much! Grabbing the libs now, but my internet is poor.. my email is gareth...@gmail.com

Gareth Murfin

unread,
Aug 28, 2019, 11:10:28 AM8/28/19
to CodenameOne Discussions
Thanks Kandy! Your libraries worked perfectly for me. Much appreciated! No idea why mine didnt work!!.. Thanks again, let me know if you ever need any help in return. 

--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/BID1gcFOGqw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/fa6721df-38b4-420d-ac2d-f00f99bd4e50%40googlegroups.com.


--
Gareth Murfin
(Android Freelancer - www.garethmurfin.co.uk)

Gareth Murfin

unread,
Aug 28, 2019, 11:54:05 AM8/28/19
to CodenameOne Discussions
hmmm now im getting android errors, im presuming these need to be set as build hints.. BluetoothLeScanner: fail to start le scan - SecurityException thrown: java.lang.SecurityException: Need ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission to get scan results


On Wednesday, August 28, 2019 at 12:25:12 AM UTC+1, Gareth Murfin wrote:

Gareth Murfin

unread,
Aug 28, 2019, 12:23:44 PM8/28/19
to CodenameOne Discussions
who knows whats going on this bluetooth library is terrible. 
issue described here.

--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/BID1gcFOGqw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.

Kandy Bitxenio

unread,
Aug 28, 2019, 1:07:53 PM8/28/19
to CodenameOne Discussions
Hi Garet, you need to activate the location on Android, se the library documentation, the bluetooth library works fine on IOS and Android.

Best Regards Kandy

Gareth Murfin

unread,
Aug 28, 2019, 1:33:54 PM8/28/19
to CodenameOne Discussions
Oh I see! Yes it seems to work, location is a weird permission to need, and I wonder why it doesnt prompt for it when it requests permission. Thanks again.

Gareth Murfin

unread,
Aug 28, 2019, 3:21:48 PM8/28/19
to CodenameOne Discussions
Still more issues, connecting I always get "Device previously connected, reconnect or close for new device". There is no way to get the address it thinks its connected to in order to call disconnect/reconnect. And it erroneously thinks that I have connected, which I havent.

Gareth Murfin

unread,
Aug 28, 2019, 3:53:44 PM8/28/19
to CodenameOne Discussions
Did you ever get the callback for connect() to work? Doesnt work here, this library seems very flakey..
Reply all
Reply to author
Forward
0 new messages