简体   繁体   中英

Where is the 'pubspec.yaml' file? Pub.dev examples won't compile in Android Studio with Flutter Plugin without adding a path, but where is it?

I have successfully installed the Flutter plugin to Android Studio on my Windows10 system, and flutter doctor -v gives me all green check marks. However, the DART examples from pub.dev fail to compile with the error message that libraries must be added to the file 'pubspec.yaml'. Where is this file? As shown below, no such file appears in the project hierarchy?

缺少 pubspec.yaml 的 Android Studio 层次结构的屏幕截图

[enter image description here][1] [1]: https://i.stack.imgur.com/Y5CDd.png

This is a default folder and file structure of a Flutter project. In your case pubspec.yaml file isn't present, which should be there. So I think this is an issue related to build. So just try to rebuild the project, and it should be cured. Just Open terminal on the Project folder and run the following commands.

 flutter clean flutter create <Exactly same project name>

This should rebuilt the project.

If this is a new project and you haven't done anything on the project yet, I will suggest to create a new project using terminal commandline, as according to me commandline with VSCode is the best way to work on flutter (Obviosusly it's based on preference).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM