I’m developing an app with Flutter in VS Code installed with Flatpak. I’m trying to debug the app with Brave, which is also installed with Flatpak. As the apps are sandboxed due to Flatpak they don’t see each other.
Is there a way to make VS Code able to launch Brave in debug mode?
https://flathub.org/apps/com.github.tchx84.Flatseal
Have you tried that?
I tried adding the location for the Brave Flatpak in VS Code Flatpak with Flatseal.
It now shows the device but I get an error when launching the app for debug from VS Code.
Launching lib/main.dart on Chrome in debug mode... [CHROME]:/var/lib/flatpak/app/com.brave.Browser/x86_64/stable/55eab7c3b790510e9175f8a064f16c84972163599c064dc833eff81bec751652/export/bin/com.brave.Browser: line 2: /usr/bin/flatpak: No such file or directory Failed to launch browser after 3 tries. Command used to launch it: /var/lib/flatpak/exports/bin/com.brave.Browser --user-data-dir=/tmp/flutter_tools.LCRXFZ/flutter_tools_chrome_device.IXGKQA --remote-debugging-port=44639 --disable-background-timer-throttling --disable-extensions --disable-popup-blocking --bwsi --no-first-run --no-default-browser-check --disable-default-apps --disable-translate http://localhost:33631 Failed to launch browser. Make sure you are using an up-to-date Chrome or Edge. Otherwise, consider using -d web-server instead and filing an issue at https://github.com/flutter/flutter/issues. Exited
I’m not sure what I need to modify to make VS Code launch Brave as a device in debug mode.
How about allow system library?
No dice, it still doesn’t work. I tried with all toggles active in Filesystem section but none seem to make it work.
Seems you need to alias brave with flatpak run. Because it tried to run brave, and because it’s not in path it won’t able to run.
flatpak run com.brave.Browser in a shell script with chmod +x to /usr/local/bin/brave
Content could be the run with $@
I’m not sure it will work, but worth to try.
You can use
flatpak-spawn —host
to run any command outside of the container but it’s a bit ugly.