6

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.

Here's a screenshot: enter image description here

4
  • Using AS. Used the "Start a new Flutter project" option.
    – stack
    Nov 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.deWit
    Nov 12, 2018 at 13:46
  • it's 8 months old question! any solution yet?
    – evals
    Aug 8, 2019 at 8:53
  • check this answers github.com/flutter/flutter/issues/28791
    – evals
    Aug 8, 2019 at 9:05

3 Answers 3

5

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
  • 1
    There is no Project Structure under File in Android Studio. Apr 10, 2020 at 17:07
2

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>
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.