10

How to execute binary file in flutter? I have put the binary into assets and added to my code function to 'unpack' it (How do I get the Asset's file path in flutter?).

The file is in the app data folder:

generic_x86:/data/data/com.example.hidden/app_flutter # ls
binaryfile flutter_assets 
generic_x86:/data/data/com.example.hidden/app_flutter # 

However when I try executing it using the Process.run it says Permission denied. When I chmod +x or chmod 777 it using root shell, it says No such file or directory. However I would prefer some no root method to do this.

How can I properly execute prebuilt binaries in Flutter? Thanks

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Makalone LOgman
  • 948
  • 1
  • 12
  • 25

1 Answers1

1

I think the way to do this is to copy your binary file from assets to a local directory, as obtained by final directory = await getApplicationDocumentsDirectory(), and to then call Process.run with that file as the command argument.

Even then, I don't believe you can run anything as root this way, and your access to the file system may be quite limited.

Bram
  • 520
  • 2
  • 7