【问题标题】:Error: No pubspec.yaml file found. This command should be run from the root of your Flutter project错误:未找到 pubspec.yaml 文件。此命令应从 Flutter 项目的根目录运行
【发布时间】:2022-01-27 16:17:31
【问题描述】:

我试图释放我的颤振应用程序的 apk。 我运行了“Flutter Build apk”命令,它弹出了这个错误。

PS C:\Users\Lenovo\Desktop\Weather App> 颤振构建 apk
错误:未找到 pubspec.yaml 文件。 此命令应从 Flutter 项目的根目录运行。

【问题讨论】:

标签: android flutter dart visual-studio-code build


【解决方案1】:

转到正确的项目路径,然后在命令下方运行

C:\Users\Lenovo\Desktop\Weather App> // 你的命令

然后运行以下命令

清理项目:

flutter clean

运行项目:

flutter run 

用于创建项目的APK文件:

flutter build apk --release

【讨论】:

    【解决方案2】:

    运行以下命令:

    flutter clean
    

    flutter pub get
    

    确保您位于根目录中。 (lib、android 等文件夹所在的文件夹)。如果您使用的是 Vs Code 之类的代码编辑器,请检查终端是否在该文件夹中。如果没有,请 cd 进入。

    【讨论】:

      【解决方案3】:

      确保您在 Weather App 的根目录中,并且 pubspec.yaml 文件在那里(所以它不会被您误删除)。 做flutter clean 然后flutter pub get 然后构建apk

      【讨论】:

        猜你喜欢
        • 2021-03-18
        • 1970-01-01
        • 1970-01-01
        • 2021-12-19
        • 1970-01-01
        • 2019-02-27
        • 2010-10-13
        • 2020-05-18
        • 2023-03-23
        相关资源
        最近更新 更多