13

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

Running "flutter pub get" in project...
    Launching lib/main.dart on Linux in debug mode...
    Exception: No Linux desktop project configured. See https://github.com/flutter/flutter/wiki/Desktop-shells#create to learn about adding Linux support to a project.

My configuration is:

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.20.0-3.0.pre.126, on Linux, locale en_US.UTF-8)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 4.0)
[✓] Connected device (3 available)

• No issues found!
4
  • What is your question? You haven't said what issue you encountered while following the instructions for setting up your project. Commented Jul 4, 2020 at 20:27
  • when I'm run a command 'flutter run -d linux' compiler show this error Commented Jul 5, 2020 at 7:11
  • following the instructions for setting up for the project has been already done! Commented Jul 5, 2020 at 7:22
  • You should update your question with the output of ls linux in your project's root directory. Commented Jul 5, 2020 at 12:26

6 Answers 6

48

you have to manually add desktop support for existing apps

run: flutter create . to add the necessary dependencies.

Sign up to request clarification or add additional context in comments.

Comments

14

To add desktop support to an existing Flutter project, run the following command in a terminal from the root project directory:

flutter create --platforms=windows,macos,linux .

src : https://flutter.dev/desktop#add-desktop-support-to-an-existing-flutter-app

2 Comments

just for who get error after running this command, need to include --org parameter if you changed the package name.
Do not miss the dot in the end of the expression
6

You might have missed step from linux desktop support. It is because you're trying to run project which is initial build from different platform (eg. mac/windows). This is according to official documentation. flutter_add_linux

Another solution is create new app by flutter create repo_name on linux. Then copy linux folder into existing repo. This will fix your problem.

Comments

3

While run desktop app error enter image description here

solution:

To add desktop support to an existing Flutter project, run the following command in a terminal from the root project directory:

enter image description here

Here we add full desktop support

flutter create --platforms=windows,macos,linux .

Only need Windows

flutter create --platforms=windows .

Only need Linux

flutter create --platforms=linux .

Tip:

To create a new application that includes desktop support (in addition to mobile and web support), run the following commands, substituting myapp with the name of your project:

flutter create myapp
cd myapp

For more Information : flutter.dev/desktop

Comments

0

Use these commands

$ flutter channel dev

$ flutter upgrade

$ flutter config --enable-linux-desktop

After running these commands start a new Flutter project and you should be good to go. :)

Comments

0

First run the following command

flutter create --platforms=windows,macos,linux .

and then run any of the following according to need.

flutter build windows

flutter build macos

flutter build linux

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

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.