Exception: Unable to generate build files in flutter

1,441

Solution 1

I found the solution by using this following command:

sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev

and

flutter config --enable-linux-desktop

Solution 2

you must install ninja.

sudo pacman -S ninja or sudo apt-get install ninja.

Share:
1,441
Hemant Jaiman
Author by

Hemant Jaiman

Updated on December 10, 2022

Comments

  • Hemant Jaiman
    Hemant Jaiman over 1 year

    I am trying to install flutter in kali linux machine. I installed flutter from official website and followed accordingly. I don't want to use android studio so I am using visual studio code.
    when I run Flutter doctor in terminal i get

    [✓] Flutter (Channel master, 2.2.0-11.0.pre.161, on Linux, locale en_IN)
    [✗] 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.dev/docs/get-started/install/linux#android-setup for detailed instructions).
          If the Android SDK has been installed to a custom location, please use
          `flutter config --android-sdk` to update to that location.
    
    [✗] 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 (the doctor check crashed)
        ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at
          https://github.com/flutter/flutter/issues.
        ✗ ProcessException: Failed to find "ninja" in the search path.
            Command: ninja 
    [!] Android Studio (not installed)
    [✓] VS Code (version 1.55.2)
    [✓] Connected device (1 available)
    
    ! Doctor found issues in 4 categories.
    

    And when i Run in visual studio i get this

    Launching lib/main.dart on Linux in debug mode...
    lib/main.dart:1
    CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
    CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
    Exception: Unable to generate build files
    Exited (sigterm)
    

    Can anyone help me with this issue please.