I am trying to open my flutter project separately in android studio with "Open android module in Android Studio" but when I left click on my flutter project window to open it this is disabled for me while "Open iOS module in Xcode" is there. Please let me know I can I enable it and can open my flutter project for android in another module.
8 Answers
>>> Only applies for Idea Intellij IDE
Okay, I finally figured out why the option is not available (greyed out).
It should be the inconsistency problem between the old version of the flutter plugin and a new one.
You might experience this issue if you created the project with a relatively old version flutter engine, and open it with a new version flutter plugin.
To know what happens and how to resolve it:
The old project contains a file:

which is not the same as in a latest created project:

So you know how to fix the issue:
Rename the iml file to (YourProjectName_android.iml) That would instantly make the menu highlight again!
9 Comments
Simply do the following:
- Right click on
androidfolder >New>File - Rename the new file myproject_android.iml (change myproject to your project name)
- Paste the bellow xml code and save it
- Right click on
androidfolder >Flutter>Open Android Module in Android Studio - Voila
Xml code:
<?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$">
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>
Comments
Go to
tools -> flutter -> open in exisiting android studio.
If it is not showing, then create a Dummy project in flutter, after that dummyFil.iml is generating with new Flutter Plugins.
Paste the dummyFil.iml file in your project.
You will see a option as open in existing android studio option.
Comments
deleting .idea folder under your_project/android/ worked for me.
1 Comment
My plugin is a pure package having no example app that also caused the same issue. I fixed at following:
Generate new plugin
flutter create --template=plugin --platforms=android -a java YourPluginNameCopy example app into my plugin
Go to example/android, right click on your_plugin_example.iml, Flutter/Open for Editing on Android Studio
The flutter module is loaded so there will be no error.
Comments
Here I got this issue i make a file in project-> android-> projectname_android.iml
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/gen" />
<option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/gen" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/app/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/app/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/app/src/main/assets" />
<option name="LIBS_FOLDER_RELATIVE_PATH" value="/app/src/main/libs" />
<option name="PROGUARD_LOGS_FOLDER_RELATIVE_PATH" value="/app/src/main/proguard_logs" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/app/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/app/src/main/kotlin" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
</content>
<orderEntry type="jdk" jdkName="11" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Flutter for Android" level="project" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
</component>
enter code here
