usb-with-serial-port
usb-with-serial-port copied to clipboard
how can i do with this problems
07/23 16:55:04: Launching 'app' on Xiaomi Redmi Note 7.
$ adb shell am start -n "com.hd/com.hd.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 13447 on device 'xiaomi-redmi_note_7-63364e0f'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/com.hd: The ClassLoaderContext is a special shared library.
I/Perf: Connecting to perf service.
W/System.err: java.io.IOException: Cannot run program "/system/bin/su": error=2, No such file or directory
W/System.err: at java.lang.ProcessBuilder.start(ProcessBuilder.java:1050)
at java.lang.Runtime.exec(Runtime.java:695)
at java.lang.Runtime.exec(Runtime.java:525)
at java.lang.Runtime.exec(Runtime.java:422)
at com.hd.serialport.help.RootCmd.execRootCmdOrder(RootCmd.kt:28)
at com.hd.serialport.help.RootCmd.execRootCmdOrder$default(RootCmd.kt:26)
at com.hd.serialport.help.RequestUsbPermission$asyncRequestAllUsbDevicePermission$1.doInBackground(RequestUsbPermission.kt:65)
at com.hd.serialport.help.RequestUsbPermission$asyncRequestAllUsbDevicePermission$1.doInBackground(RequestUsbPermission.kt:63)
W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.
你好,因为我没有在做相关业务的工作了,所以这个库就没再做相关测试。看到你提的问题,检索到源码 usbserialport/src/main/java/com/hd/serialport/help/RootCmd.kt, 这个类是通过shell的方式在请求usb权限,代码里面做过try/catch, 理论上库不会崩溃,除非定制系统处理不了这句话自己崩了。涉及到硬件及实际环境,这里只能做下推测,如果你时间充沛,可以尝试使用库源码去调试,当然最后的办法就是删除那句话,祝好运