0

I am trying CAN communication using Debix i.MX8 SBC with Android 11 installed. Am running a flutter app in which I need to run CAN(Controller Area Network) commands using adb shell.

Commands I need to run are:

 adb shell
 ifconfig can0 up

I used process_run dart package and tried the following.

  var shell = Shell();
  await shell.run("ifconfig can0 up");

But it is not working. It is throwing "ShellException(ifconfig can0 down, exitCode 1, workingDirectory: /)"

How to execute these shell commands through flutter application/using dart?

3
  • Are you talking about performing adb commands from within an Android app, or a Flutter app on PC side? Commented Jul 24, 2024 at 14:28
  • I want to run adb commands from flutter mobile app. Only for Android, not for other platforms. Android version is 11. Commented Jul 24, 2024 at 17:46
  • Android is not designed to allow access to adb fromwithin an app. There are some workarounds known where after each reboot you have to connect via USB and enable adb tcp mode (adb tcpip 5555). Then you would have to include a cross-compiled adb binaries for the Android CPU architecture into your app and use them to connect voa TCP to the adbd on the same device. Commented Jul 26, 2024 at 11:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.