Flutter Desktop Linux build failed

5.5k Views Asked by At

When I try to build my app to Flutter Desktop its fail with this message:

Launching lib/main.dart on Linux in debug mode...
Exception: Build process failed

My configuration is:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.19.0-2.0.pre.142, on Linux, locale pt_BR.UTF-8)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 3.6)
[✓] Connected device (1 available)

Can anyone know how to fix this?

Thanks

4

There are 4 best solutions below

0
On

In my case, it was a dependencies problem. I was trying to use svg_flutter package in a desktop app (which is not supported).

Try running flutter run -v -d linux and check if any error message corresponds with new packages that you added recently.

0
On

I had the same issue.

First I ran flutter run -v -d linux, I followed the log and I noticed it an OS Error

Unhandled exception:
FileSystemException: Setting current working directory failed

So, I firstly switch to the master channel (solution for some people), run flutter upgrade and I was getting the same error.

My working dir is /home/xylia/Flutter\ Apps/github_pages and I felt it might be the space from the folder name (I had an issue like that once), so I created a new folder without space and it worked!

I am not totally sure if changing channel to master helped but there is no harm in doing it

0
On

I don't know if you already found a solution but for everyone having this problem, I solved it by doing the following:

Inside your project root directory delete the linux folder, like rm -rf linux.

Run flutter clean to delete the build folder and other related files.

Then run flutter create . to make flutter recreate your linux folder.

0
On

I had the same problem my fix was to create/run the flutter project on primary SSD/HDD drive.