Flutter Linux build error X window system error - linux

I'm trying to code in flutter for Linux platform and flutter depend on https://docs.gtk.org/gtk3/
I have updated my system to (Elementary os) and after updating and install builds tools for flutter for Linux build to get this error
when run flutter run -d linux i get that:
Launching lib/main.dart on Linux in debug mode...
(store_items:6176): Gdk-ERROR **: 10:22:28.017: The program 'store_items' received an X Window System error.
This probably reflects a bug in the program.
The error was 'GLXBadFBConfig'.
(Details: serial 244 error_code 167 request_code 152 (GLX) minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the GDK_SYNCHRONIZE environment
variable to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Error waiting for a debug connection: The log reader stopped unexpectedly.
Error launching application on Linux.
Exited (sigterm)
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.2, on elementary OS 6 Odin 5.11.0-37-generic, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.60.2)
[✓] Connected device (2 available)
flutter doctor -v output:
Flutter (Channel stable, 2.5.2, on elementary OS 6 Odin 5.11.0-37-generic, locale en_US.UTF-8)
• Flutter version 2.5.2 at /home/rasol/DevTools/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 3595343e20 (4 days ago), 2021-09-30 12:58:18 -0700
• Engine revision 6ac856380f
• Dart version 2.14.3
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /home/rasol/DevTools/Android
• Platform android-31, build-tools 31.0.0
• ANDROID_HOME = /home/rasol/DevTools/android
• Java binary at: /home/rasol/Apps/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[✓] Android Studio (version 2020.3)
• Android Studio at /home/rasol/Apps/android-studio
• Flutter plugin version 59.0.2
• Dart plugin version 203.8292
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[✓] VS Code (version 1.60.2)
• VS Code at /usr/share/code
• Flutter extension version 3.26.0
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • elementary OS 6 Odin 5.11.0-37-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 94.0.4606.71
• No issues found!

Related

Why i can run flutter command in linux terminal, but not in vscode terminal?

I use ZorinOS. I installed flutter and run flutter doctor, and everything is fine. I created new flutter project and run flutter doctor from command pallete in vscode and i get:
[flutter] flutter doctor -v
[✓] Flutter (Channel stable, 3.3.2, on Freedesktop.org 21.08.15 (Flatpak runtime) 5.15.0-46-generic, locale en_US.UTF-8)
• Flutter version 3.3.2 on channel stable at /home/lock_rr/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision e3c29ec00c (27 hours ago), 2022-09-14 08:46:55 -0500
• Engine revision a4ff2c53d8
• Dart version 2.18.1
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /home/lock_rr/Android/Sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /home/lock_rr/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Linux toolchain - develop for Linux desktop
• clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
• cmake version 3.10.2
• ninja version 1.8.2
• pkg-config version 0.29.1
[✓] Android Studio (version 2021.2)
• Android Studio at /home/lock_rr/android-studio
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] Connected device (1 available)
• Linux (desktop) • linux • linux-x64 • Freedesktop.org 21.08.15 (Flatpak runtime) 5.15.0-46-generic
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
exit code 0
But when i run flutter doctor in my linux terminal, i get a different output:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.2, on Zorin OS 16.1 5.15.0-46-generic, locale
en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
• No issues found!
When i try to run flutter run in vscode terminal, i get:
sh-5.1$ flutter run
sh: flutter: command not found
But i can run it with command pallete and linux terminal.I try to use bash in my vscode terminal but nothing changed. So how can i fix this?
Note: instead of chrome,i fill my CHROME_EXECUTABLE with chromium. But it's not detected as issue when i run flutter doctor at linux terminal.
Edit:
i try to reinstall flutter, but still can't access it. But i try which flutter in my vscode terminal and got:
sh-5.1$ which flutter
which: no flutter in (/app/bin:/app/bin:/app/bin:/usr/bin:/home/lock_rr/.var/app/com.visualstudio.code/data/node_modules/bin)
So after some trial and error. i found that the source of my problem was my vscode. I installed vscode from the linux software store and it didn't work. I reinstalled from the vscode website and it worked

Linux Fultter desktop - unable to run app from compiled executable, flutter run works

Flutter doctor output:
[✓] Flutter (Channel master, 1.19.0-2.0.pre.193, on Linux, locale pl_PL.UTF-8)
• Flutter version 1.19.0-2.0.pre.193 at /home/michal/android/flutter
• Framework revision fed18fc433 (3 hours ago), 2020-05-29 03:43:01 -0400
• Engine revision 17737e6fd4
• Dart version 2.9.0 (build 2.9.0-11.0.dev 6489a0c68d)
[✓] Android toolchain - develop for Android devices (Android SDK version
29.0.0-rc2)
• Android SDK at /home/michal/Android/Sdk
• Platform android-29, build-tools 29.0.0-rc2
• ANDROID_HOME = /home/michal/Android/Sdk
• Java binary at: /home/michal/android/studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 9.0.1-12
• cmake version 3.16.3
• ninja version 1.10.0
[✓] Android Studio (version 3.6)
• Android Studio at /home/michal/android/studio
• Flutter plugin version 45.1.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build
1.8.0_212-release-1586-b4-5784211)
[✓] VS Code (version 1.45.1)
• VS Code at /usr/share/code
• Flutter extension version 3.8.1
[✓] Connected device (4 available)
• Android SDK built for x86 64 • emulator-5554 • android-x64 • Android 10
(API 29) (emulator)
• Linux • Linux • linux-x64 • Linux
• Web Server • web-server • web-javascript • Flutter
Tools
• Chrome • chrome • web-javascript • Google
Chrome 84.0.4147.21 dev
• No issues found!
My app compiles succesfully and I am able to run it without any issues with flutter run -d Linux. However, that does not work when I try to run directly compiled executable, in this case I'm getting error message:
embedder.cc (781): 'FlutterEngineInitialize' returned 'kInvalidArguments'. Not running in AOT mode but could not resolve the kernel binary.
Failed to start Flutter engine: error 2
Failed to create window.
Command to compile:
flutter build linux
Any suggestion how to get it running as standalone app?
It sounds like you are trying to run the executable that's at the top level of the build output. You need to instead run the copy in the bundle subdirectory of the build directory, which has all the supporting files in the correct relative locations.
Once Linux is further along, details of how to use what's in the build directory will be documented somewhere.
Any suggestion how to get it running as standalone app?
The bundle directory as a whole is the standalone app. If you mean having everything in a single executable file without any supporting files needed, that's not possible.

Android Studio do not sees a Chrome device

I am using a Flutter SDK for building a web application.
In these latter days i am trying to working on Linux, and i ran into a problem: Android Studio do not sees a Chrome in device list.
You can say what Flutter SDK is not properly configured, but no - Flutter seed a chrome device, and also Flutter can run a application in chrome via flutter run -d chrome command.
Has anyone encountered a same problem?
Flutter doctor output:
[urusai#mikhail-pc ka4alka-voting]$ flutter doctor -v
[✓] Flutter (Channel beta, v1.14.6, on Linux, locale ru_RU.UTF-8)
• Flutter version 1.14.6 at /usr/lib/flutter
• Framework revision fabeb2a16f (4 недели назад), 2020-01-28 07:56:51 -0800
• Engine revision c4229bfbba
• Dart version 2.8.0 (build 2.8.0-dev.5.0 fc3af737c7)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /home/urusai/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• CHROME_EXECUTABLE = /opt/google/chrome/google-chrome
[✓] Android Studio (version 3.6)
• Android Studio at /opt/android-studio
• Flutter plugin version 43.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Connected device (2 available)
• Chrome • chrome • web-javascript • Google Chrome 80.0.3987.122
• Web Server • web-server • web-javascript • Flutter Tools
• No issues found!
Try launch Android studio via terminal.
if it the case, that Chrome(web) device is shown only when u run it via terminal. This means if u can copy your bash ~/.bashrc environment variable to user wide variable ~/.profile it can be fixed.
Try set up your environment variable in ~/.profile so it the same in ~/.bashrc

VS code and Android Studio can't find emulator

Android studio and VS code show me both no devices but flutter doctor shows no issues and the flutter run command runs the app fine
Output in Terminal:
flutter doctor -v
[✓] Flutter (Channel beta, v1.3.8, on Linux, locale de_DE.UTF-8)
• Flutter version 1.3.8 at /home/nuggetz/Programme/flutter
• Framework revision e5b1ed7a7f (vor 3 Wochen), 2019-03-06 14:23:37 -0800
• Engine revision f4951df193
• Dart version 2.2.1 (build 2.2.1-dev.0.0 571ea80e11)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /home/nuggetz/Programme/android/
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /home/nuggetz/Programme/android/
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.
[✓] Android Studio (version 3.3)
• Android Studio at /opt/android-studio
• Flutter plugin version 34.0.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)
• No issues found!
EDIT: when i run in Android Studio Tools > Flutter > flutter doctor I get this output:
/home/nuggetz/Programme/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel beta, v1.3.8, on Linux, locale de_DE.UTF-8)
• Flutter version 1.3.8 at /home/nuggetz/Programme/flutter
• Framework revision e5b1ed7a7f (vor 4 Wochen), 2019-03-06 14:23:37 -0800
• Engine revision f4951df193
• Dart version 2.2.1 (build 2.2.1-dev.0.0 571ea80e11)
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.io/setup/#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
You may also want to add it to your PATH environment variable.
[✓] Android Studio (version 3.3)
• Android Studio at /opt/android-studio
• Flutter plugin version 34.0.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
Process finished with exit code 0
If the status bar reads No Devices Flutter has not been able to discover any connected iOS or Android devices or simulators. You need to connect a device, or start a simulator, to proceed.
The Flutter extension automatically selects the last device connected. However, if you have multiple devices/simulators connected, click device in the status bar to see a pick-list at the top of the screen. Select the device you want to use for running or debugging.
Flutter.dev
just move all sdks from /home/nuggetz/Programme/android/ to /usr/lib/android-sdk

Flutter Finished with error: ProcessException: Permission denied

I want to run my frist app with flutter but I got the following error :
Launching lib/main.dart on Android SDK built for x86 64 in debug mode.
Initializing gradle.
Resolving dependencies.
Finished with error shown below:
ProcessException: Permission denied Command:
/home/abdoul-razak/Android/Sdk/build-tools/28.0.3/aapt dump xmltree
/home/abdoul-razak/Projects/akoybiz/build/app/outputs/apk/app.apk
AndroidManifest.xml
here is the result of flutter doctor:
abdoul-razak#Komche:~/Projects/akoybiz$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.0.0, on Linux, locale fr_FR.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
✗ Android license status unknown.
[✓] Android Studio (version 3.0)
[✓] VS Code (version 1.30.2)
[✓] Connected device (1 available)
! Doctor found issues in 1 category.
after updating the sdk android here is the result of flutter doctor -v
abdoul-razak#Komche:~/Projects/akoybiz$ flutter doctor -v
[✓] Flutter (Channel stable, v1.0.0, on Linux, locale fr_FR.UTF-8)
• Flutter version 1.0.0 at /home/abdoul-razak/flutter
• Framework revision 5391447fae (il y a 9 semaines), 2018-11-29 19:41:26
-0800
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
• Android SDK at /home/abdoul-razak/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling
support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /home/abdoul-razak/Android/Sdk
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
• All Android licenses accepted.
[✓] Android Studio (version 3.0)
• Android Studio at /opt/android-studio
• Flutter plugin version 23.2.1
• Dart plugin version 171.4424
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
[✓] VS Code (version 1.30.2)
• VS Code at /usr/share/code
• Flutter extension version 2.22.2
[✓] Connected device (1 available)
• itel P31 • 45YP8LSO4T7HWCLZ • android-arm • Android 7.0 (API 24)
• No issues found!
The issue is related to your Android SDK licenses. Run the command
flutter doctor --android-licenses
Then press y until it acquires all permissions.
xattr -d com.apple.quarantine ./gradlew
By using this command it solves the issue. I don't know the exact reason but it worked for me.
I stumbled across the same exception. And something fixed it, but I do not know what exactly.
The exception says something different but I think it has something to do where flutter is installed. I reinstalled it again like suggested on their website and it worked...
cd ~/development
tar xf ~/Downloads/flutter_linux_v1.7.8+hotfix.4-stable.tar.xz
Edit: Make sure you use a local folder for your flutter project too.

Resources