Crash when attempting to open a connection
See original GitHub issueWhen I try to open a serial connection with serial.open({baudRate:57600}, sCallback, eCallback)
, the entire app crashes. This is the error it prints to the ADB log:
08-03 06:01:27.594 28970 29027 D Serial : Action: openSerial
08-03 06:01:27.601 28970 29000 E AndroidRuntime: FATAL EXCEPTION: pool-1-thread-1
08-03 06:01:27.601 28970 29000 E AndroidRuntime: Process: io.cordova.hellocordova, PID: 28970
08-03 06:01:27.601 28970 29000 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'android.hardware.usb.UsbDevice com.hoho.android.usbserial.driver.UsbSerialDriver.getDevice()' on a null object reference
08-03 06:01:27.601 28970 29000 E AndroidRuntime: at fr.drangies.cordova.serial.Serial$3.run(Serial.java:226)
08-03 06:01:27.601 28970 29000 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
08-03 06:01:27.601 28970 29000 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
08-03 06:01:27.601 28970 29000 E AndroidRuntime: at java.lang.Thread.run(Thread.java:818)
08-03 06:01:27.607 858 3262 W ActivityManager: Force finishing activity io.cordova.hellocordova/.MainActivity
Any ideas?
Issue Analytics
- State:
- Created 7 years ago
- Comments:29 (8 by maintainers)
Top Results From Across the Web
Computer crashes while trying to connect to my wireless network
As I understand, your computer crashed while trying to connect to a wireless network. 1. Are you aware of making any changes to...
Read more >Fix Chrome if it crashes or won't open - Computer - Google Help
First: Try these common Chrome crash fixes · Close every tab except for the one that's showing the error message. · Quit other...
Read more >Crash occurs when trying to open any cloud model in Revit
This behavior may occur following a Windows Blue Screen event or Video Driver error. Models are no longer able to be initiated to...
Read more >PuTTY Crash on Open - Google Groups
the Open button to establish a connection, PuTTY crashes, and Windows gives ... try to open it, I get the message "putty.exe has...
Read more >Why does My PC Keep Crashing? Here're 10 Fast Fixes!
What's more, you'll know how to recover data from crash computer that won't boot. ... Launch 4DDiG and connect the USB drive to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@FilipMatys, Yes buddy, I got that by now. I have also done a test build for the app. Now making the changes for not considering read endpoint. Hopefully, I will get it right.
Keeping my finger crossed. 🤞
So I made it work. To avoid the same frustration I have been through, here is how I did it:
I had to download this library: https://github.com/mik3y/usb-serial-for-android
It is the one this plugin is dependent on. Unfortunately, the library in this plugin is quite old and expects the device to have multiple interfaces. New version of the library does not.
I used this fork, which uses raw files, not library: https://github.com/r1000ru/cordovarduino
I removed obsolete files from config.xml (like example files) and copied the new library into that fork. Watch for proper paths!
Still, it was not enough 😃 But it might be for you.
I went through the driver code and found out it required both read and write endpoints. And that was the reason, why connection with my printer could not be opened. I modified the driver to not require 3 endpoints and to not throw exception when there is no read endpoint.
And thank the Almighty whoever that is, it works now.