BbsonLin / serial_port_flutter

A Flutter plugin integrated with Android-SerialPort-API
Other
29 stars 24 forks source link

listDevices can not find new plugin usb serial port device #9

Closed lee4git closed 3 years ago

lee4git commented 4 years ago

modify serial_port_flutter/android/src/main/java/com/example/flutter_serial_port/FlutterSerialPortPlugin.java

1. // private SerialPortFinder mSerialPortFinder = new SerialPortFinder();

2. private ArrayList getAllDevices() { //ArrayList devices = new ArrayList(Arrays.asList(mSerialPortFinder.getAllDevices())); ArrayList devices = new ArrayList(Arrays.asList( new SerialPortFinder().getAllDevices())); return devices; } 3. private ArrayList getAllDevicesPath() { //ArrayList devicesPath = new ArrayList(Arrays.asList(mSerialPortFinder.getAllDevicesPath())); ArrayList devicesPath = new ArrayList(Arrays.asList(new SerialPortFinder().getAllDevicesPath())); return devicesPath; }

hakanbakacak commented 3 years ago

After clone the repo, I run the example project and when I click on the devices button in the settings section, I get an exception. image The exception I got in the platform_channel.dart file is like this image Also the find devices function in pub.dev gives this error.

Future<List<Device>> findDevices() async {
  return await FlutterSerialPort.listDevices();
}
BbsonLin commented 3 years ago

Hi @hakanbakacak, Are you running the example app on Windows desktop?

hakanbakacak commented 3 years ago

Yes, I am running the example app on Windows desktop. Do you have any suggestions for a solution for this issue?

BbsonLin commented 3 years ago

Hi @hakanbakacak, I open another issue for this problem. #10