简体   繁体   English

Flutter 桌面 Linux 构建失败

[英]Flutter Desktop Linux build failed

When I try to build my app to Flutter Desktop its fail with this message:当我尝试将我的应用程序构建到 Flutter 桌面时,它会失败并显示以下消息:

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谢谢

I had the same issue.我遇到过同样的问题。

First I ran flutter run -v -d linux , I followed the log and I noticed it an OS Error首先我跑了flutter run -v -d linux ,我跟着日志,我注意到它是一个操作系统错误

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.所以,我首先切换到主通道(某些人的解决方案),运行 flutter 升级,我得到了同样的错误。

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!我的工作目录是/home/xylia/Flutter\ Apps/github_pages ,我觉得它可能是文件夹名称中的空格(我曾经遇到过这样的问题),所以我创建了一个没有空格的新文件夹,它工作了!

I am not totally sure if changing channel to master helped but there is no harm in doing it我不完全确定将频道更改为 master 是否有帮助,但这样做没有害处

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 .在您的项目根目录中删除 linux 文件夹,例如rm -rf linux

Run flutter clean to delete the build folder and other related files.运行flutter clean以删除构建文件夹和其他相关文件。

Then run flutter create.然后运行flutter create. to make flutter recreate your linux folder.使 flutter 重新创建您的 linux 文件夹。

I had the same problem my fix was to create/run the flutter project on primary SSD/HDD drive.我遇到了同样的问题,我的解决方法是在主 SSD/HDD 驱动器上创建/运行 flutter 项目。

In my case, it was a dependencies problem.就我而言,这是一个依赖问题。 I was trying to use svg_flutter package in a desktop app (which is not supported).我试图在桌面应用程序中使用svg_flutter package(不支持)。

Try running flutter run -v -d linux and check if any error message corresponds with new packages that you added recently.尝试运行flutter run -v -d linux并检查是否有任何错误消息与您最近添加的新软件包相对应。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM