I’m trying to use Bluetooth Classic from a Processing app (version 3.5.4) in the Android mode with a Serial library download from the internet “AndroidSerial”. Source code which fails is as follows:
The app crashes when the triangle is pressed. Error message follows:
FATAL EXCEPTION: Animation Thread
Process: processing.test.serialtest, PID: 18741
java.lang.IllegalArgumentException: This library works only on Android.
at com.yourinventit.processing.android.serial.SerialCommunicatorFacory.create(SerialCommunicatorFacory.java:67)
at com.yourinventit.processing.android.serial.Serial.<init>(Serial.java:41)
at com.yourinventit.processing.android.serial.Serial.<init>(Serial.java:50)
at com.yourinventit.processing.android.serial.Serial.list(Serial.java:263)
at processing.test.serialtest.serialTest.draw(serialTest.java:37)
at processing.core.PApplet.handleDraw(PApplet.java:1852)
at processing.core.PSurfaceNone.callDraw(PSurfaceNone.java:476)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:516)
I note that the library works only on Android, but the Android mode is selected and an Android sdk is installed on my system (macOS).
@noel very helpful. Latest version of library no longer causes crash. However, now I get the following error message and I’m not sure how to fix it:
Processing-Android USB Serial ERROR
Port:null
Check the following:
1) Make sure AndroidManifest.xm. contains <use-feature> tag for android.hardware.usb.host
2) USB Serial is connected to the device
I’m trying to get this demo to run on a Samsung tablet using an Arduino UNO connected to a Mac mini as the data source. The UNO has a classic Bluetooth shield which is sending test data (tested in another Processing java app and this is working). I have checked all the Bluetooth boxes under Android/Sketch Permissions but do not see “use-feature” in the manifest which is shown below:
Adding the “uses-feature” to the manifest in the project folder didn’t solve the problem. I still get the same error message, therefore I am unable to get the demo to give me a serial port list. However, I have looked in the tablet’s settings and can see that I have previously paired the Bluetooth shield for use with another app. Just to see what would happen, I unpaired it and tried to re-pair it. Now it does not show the shield as being available for pairing and I am unsure why. For now it appears that recognition of the port is the problem and will need more trouble-shooting. I appreciate your help. Will provide follow-up if I ever get it working.
@noel - USBDeview appears to be a Windows app and I’m doing this on a Mac. The serial ports on a Mac may be displayed in Terminal using the command “ls /dev/cu.*”. At any rate, I think I’m going down the wrong road; what I need is a list of paired Bluetooth devices and devices available for pairing on my Android tablet. Therefore, I don’t think “println(Serial.list(this))” will work for this purpose. Hopefully, there is another way to find Bluetooth devices using Processing Android; I need to read some more. Thanks.