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!
you have to manually add desktop support for existing apps
run: flutter create .
to add the necessary dependencies.
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
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.
While run desktop app error
solution:
To add desktop support to an existing Flutter project, run the following command in a terminal from the root project directory:
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
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. :)
Related
I installed Flutter beta version using official guide.
Enabled web:
flutter channel beta
flutter upgrade
flutter config --enable-web
The result is:
Setting "enable-web" value to "true".
You may need to restart any open editors for them to read new settings.
The result of flutter devices command:
>flutter devices
1 connected device:
Web Server • web-server • web-javascript • Flutter Tools
The official guide points that there should be two devices:
Chrome • chrome • web-javascript • Google Chrome 78.0.3904.108
Web Server • web-server • web-javascript • Flutter Tools
I created sample app from the official guide and tried to build it:
flutter create myapp
cd myapp
flutter run -d chrome
The result is:
No devices found with name or id matching 'chrome'
Latest Google Chrome is installed. I have read on github the problem could be solved by setting environment variable CHROME_EXECUTABLE. I tried to set it using path to chrome.exe and path to folder containing chrome.exe with same unsuccessful result.
I executed flutter doctor -v:
[X] Chrome - develop for the web (Cannot find chrome executable at "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")
! "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" is not executable.
I thought the problem could be in path with spaces but setting different path in CHROME_EXECUTABLE does not solve the problem.
[X] Chrome - develop for the web (Cannot find chrome executable at "D:\Portable\Chromium\chrome-win\chrome.exe")
! "D:\Portable\Chromium\chrome-win\chrome.exe" is not executable.
Does anybody have any idea?
Did you try to switch to master channel ? Or to run "flutter create ." in the project root ?
If not, you can try :
flutter channel master
flutter upgrade
flutter config --enable-web
cd <into project directory>
flutter create .
flutter run -d chrome
This solution worked for me:
$ flutter upgrade
$ flutter config --enable-web
$ flutter run -d chrome
If chrome is not available in Flutter device selection try restarting the IDE.
As OP suggested I am listing my comments from above, as an answer. I believe the portable chrome usage is new w.r.t flutter and suspect this could be useful for others instead of deleting the question.
Some of the options you can try in Windows 10 are.
Run the refreshenv command in the commanda prompt.
Make sure to have correct flutter installation in your path.
Remove the double quotes " " around the path string.
In this case the 3rd option solved the issue.👍
Create system environment variables for user and system with
Variable name: chrome
Variable path: path_to_chrome
turns out thiscan be fixed by switching channels
i.e.
flutter channel
flutter channel beta
I made my project on Windows computer, now I'm trying to export to ios on friend's Mac. I've been following this tutorial from part 1 all the way to part 5. How to Install and Setup Flutter for App Development on Mac - Part 1. In other words, Xcode is installed, Android Studio with Flutter and dart plugin installed as well. Android Studio recognizes both simulator and plugged iPhone. When I open the project in Android Studio it looks like this:
Note: Both flutter folder and the project folder are located in "exportalex"
Please try to use terminal and hit this: flutter pub get
You need to load all the dependency before run app.
If still you are facing same issue, please run: flutter doctor
Then share screenshot of result.
I want to conveniently develop Desktop applications using Flutter & Android Studio. Currently Flutter Desktop Apps run only on the master channel.
I'm able to flawlessly enable MacOS as a flutter device with export ENABLE_FLUTTER_DESKTOP=true where my macos laptop shows as the following device:
$ flutter devices
1 connected device:
macOS • macOS • darwin-x64 • Mac OS X 10.14.5 18F132
I can launch the app directly on desktop with flutter run
Which Run/Debug configuration should I choose to automatically build & launch Flutter app from Android Studio?
Flutter ver. Channel master, v1.9.8-pre.108
EDIT: as #smorgan correctly suggested, just run:
flutter config --enable-macos-desktop
Remember that you also need to have macos build target in your app workspace:
You should not use ENABLE_FLUTTER_DESKTOP; any instructions referencing it are out of date. You should instead run flutter config --enable-macos-desktop as described in the official documentation.
That approach will enable desktop support everywhere, including Android Studio, rather than just the current terminal. Once you do that, normal Flutter workflows in Android Studio will work for desktop.
I'm creating a new flutter project in Android studio. I give the project a name and choose Flutter application. I then clicked finish and then nothing happened.
Android studio says that
"Flutter create command was unsuccessful"
When I navigate to command directory using file explorer, a new folder is created with the project name I've given but it is empty.
Please help.
A simple Android Studio restart did the trick for me
I've solution to this problem now.
After running flutter doctor --android-licenses I got to know that I need to update my sdkManager.
Then I went to that directory using
cd C:\Users\[user-name]\AppData\Local\Android\Sdk\tools\bin
and run sdkmanager --update
Then I restarted the Android Studio and tried creating flutter project.
It worked.
check your FLUTTER SDK path of the project (android studio: file -> settings -> Language & framework -> flutter -> flutter sdk path) . Or execute flutter doctor command in flutter consol.(This worked for me)
please install all the dependencies that flutter wants
Operating Systems: Linux (64-bit)
Disk Space: 600 MB (does not include disk space for IDE/tools).
Tools: Flutter depends on these command-line tools being available in your environment.
*bash
*curl
*file
*git 2.x
*mkdir
*rm
*unzip
*which
*xz-utils
*zip
Shared libraries: Flutter *test command depends on this library being available in your environment.
libGLU.so.1 - provided by mesa packages such as libglu1-mesa on Ubuntu/Debian and mesa-libGLU on Fedora
Look at Flutter sdk path while Creating the Project.
$ C:\flutter
If your Flutter SDK is updated and the path is right you will get a solution.
Check your Flutter SDK path.
Check the package name. It must be in lower case.
Restart your IDE and check again.
I'm a beginner in Flutter and I've an emulator opened/powered on and android studio doesn't detect it.
Hence I can't run any program because "no device is running". I've tried installing 'Android emulator' in the SDK tools but android studio still cant detect it.
Android Studio device list shows "loading" and no devices connected. Thus, I opened emulator but I cannot run flutter on emulator on Android Studio. After 5 hours I found that the reason is the new Flutter version.
I solved with choose different version of Dart and Flutter!
You need to download 1.17.3 version. Quick download link: Dowloand Flutter SDK 1.17.3 Version
And switch Stable Channel & Dart: 2.8.4, this is important. Also, if you want, you can check all versions of Flutter SDK: Flutter Versions
On MacOS, just write terminal: flutter channel stable
Note: If this answer is not working for you, you can open android module of your flutter app in Android Studio. It can be helpful when you try to add Firebase skills.
I had same problem.
CMD: flutter devices
No devices detected.
CMD: device emulators
Device emulator-5554 is offline.
In Android virtual device manager, I cold boot emulator and it started working.
In a windows platform I did:
If you have ran flutter doctor and there is no issues and if you can run your flutter app in cmd or using VSCode:
Just try to open Android Studio or IntelliJ as administrator by right clicking on the icon. This may list down devices and solve your problem.
The reason may be you have cloned flutter repository or you don't have right permission in flutter installed directory.
Run flutter doctor command to check whats the problem.
In terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device.
Check your flutter plugin whether it is up to date.
And read this flutter run: No connected devices , You may find the solution.
For me (on a Mac) I had the Android SDK installed in a custom location so I needed to set the ANDROID_HOME environment variable. In the terminal you can check what this value is with:
echo $ANDROID_HOME
I added the Android SDK to my .bash_profile (might be a different file if you are using Linux or Windows) for both ANDROID_HOME and PATH.
# already had these
export PATH="$PATH":"/opt/android-sdk/tools"
export PATH="$PATH":"/opt/flutter-sdk/bin"
# added this
export ANDROID_HOME="/opt/android-sdk"
Replace /opt/android-sdk with wherever yours is.
Then I updated the variables with
source .bash_profile
Testing with flutter doctor showed it was working.
flutter doctor
I restarted Android Studio and the emulator worked.
The last version of Flutter 1.17.5 (release the 2th, July) solved this issue for me.
Just flutter upgrade
run Flutter doctor to make sure you install everything.
run Flutter devices to see whether it is detected by flutter or not.
if you can find the your emulator there run flutter run -d <YOUR_EMULATOR_ID>
if you unable to find your emulator there may be you have to accept the android licenses . run flutter doctor --android-licenses to accept.
run flutter emulators to see list of emulators you have.
run flutter emulators --launch <emulator id> to launch
run Flutter devices to check whether emulator is detected by flutter or not.
run flutter run -d <YOUR_DEVICE_ID>
What worked for me is, updating Android Emulator.
Visit SDK Manager
Check whether any updates available for Android Emulator
If available, install the newest version
Hope this would be helpful!!!
I had this issue on Android Studio.
I had an emulator but it was not recognized even though the emulator was open.
I got around this by launching developer mode inside of the actual emulator by following the steps in this link: https://tweaklibrary.com/how-to-enable-developer-mode-on-android/#:~:text=How%20to%20Enable%20Developer%20Options%20On%20Android.%201,one%20of%20the%20most%20powerful%20...%20More%20items
After setting the emulator to developer mode, the emulator phone appeared as an option and when I ran the flutter hello world it appeared on the emulator.