android - 异常 : Unable to generate build files in flutter

标签 android visual-studio flutter kali-linux

我正在尝试在 kali linux 机器上安装 flutter 。我从官方网站安装了flutter并进行了相应的操作。我不想使用 android studio,所以我使用的是 Visual Studio 代码。
当我在终端运行 Flutter doctor 时,我得到

[✓] 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.
当我在 Visual Studio 中运行时,我得到了这个
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)
谁能帮我解决这个问题。

最佳答案

我通过使用以下命令找到了解决方案:

sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev
 
flutter config --enable-linux-desktop

关于android - 异常 : Unable to generate build files in flutter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67169985/

相关文章:

android - 如何在 Firebase 电子邮件验证中使用操作代码设置

android - 如何在 libgdx 中使用网络框架(volley、okhttp 等)?

c# - Visual Studio 解决方案中的 Markdown 文档

visual-studio - Visual Studio 团队资源管理器无法正确打开 PDF 文件 - 解决方案资源管理器不适用于 "open with"设置

android - 从原生 Android 主屏幕小部件调用 Flutter (Dart) 代码

firebase-realtime-database - 如何在 Flutter 的 FirebaseDatabase 插件中使用 ServerValue

android - 在触摸安卓上隐藏操作栏

c# - 删除 Visual Studio 中未使用的代码

Flutter GetX 路由历史

java - 如何将一个 onClickListener 应用于多个 View 持有者