My project structure only consists of the Android module, and doesn't show the ios and lib directory. Besides, why is the Android directory treated as a module rather than just a directory? It also has its own iml file named project_name_android.iml. I'm not able to run the project because AS complains that the entry point (main.dart) is missing. When I check in the folder, it's actually there, but it won't show on AS.
-
Using AS. Used the "Start a new Flutter project" option.– stackNov 12, 2018 at 12:42
-
Maybe something with the Flutter/Dart plugin? Maybe run the futter doctor to find out if something else is broken.– G.deWitNov 12, 2018 at 13:46
-
it's 8 months old question! any solution yet?– evalsAug 8, 2019 at 8:53
-
check this answers github.com/flutter/flutter/issues/28791– evalsAug 8, 2019 at 9:05
3 Answers
I solved this problem on Android Studio OSX, this is my steps :
- Android studio -> File -> Project Structure
- On project setting dialog -> see menu -> choose Module
- Choose your project -> click <+ Add content root>
- Choose your root flutter project folder -> OK to finish
- everything comes back to you
Hope this help
-
1
Further to https://stackoverflow.com/users/5643951/taulant-loshi answer above, please add yourProjectName.iml file in the root folder of project with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" />
</component>
</module>
I would suggest to check if you have the file yourProjectName.iml in the root folder of project. If that file does not exist then Android Studio doesn't know which folder structure to create and for this you cannot see you lib folder when it displays the window to set the flutter entry point.