question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to add Flutter Module to Flutter Application/Project

See original GitHub issue

Unable to add Flutter Modules to my Flutter Project so that I can separate out common logic/ui etc that will be used across multiple apps.

Steps to Reproduce

  • Create a new, default, Flutter Project
  • Click on File -> New -> New Module
  • From the ‘New Module’ dialog box, select Flutter and click Next
  • Change the Project Type to ‘Module’, leave all other settings as-is and click ‘Finish’

Expected

A new Flutter Module to appear in my project.

Actual

An error dialog box appears: ‘Internal Error: Unable to determine Flutter project directory’.

Version info

flutter_doctor.txt

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
stevemessickcommented, Sep 9, 2022

IntelliJ modules are not supported in Flutter apps. You can use Dart packages and Flutter plugins instead.

0reactions
strangedreamsNYcommented, Sep 13, 2022

@stevemessick Curious. B/C that ‘New Module’ dialog does still include the Flutter Project as an option. There’s probably some way around this. Just to be clear, my intent is to work on Flutter projects similarly to other Java/C# projects where you might have multiple ‘primary’ applications but a common backing library. In my case, I’m developing a ‘lite’ version of an application with a subset of features, so moving all the common Widget/Bloc work to a shared module seems to make the most sense. But I’d rather not have to keep 3 instances of Android Studio open to do it.

I have found a workaround in the meantime (I think):

  • Create a new Flutter Module using the command line or as a separate Android Studio project.
  • Open the Project Structure dialog and select ‘Modules’
  • Click on the ‘add’ icon and select ‘Import Module’
  • Locate the folder of the previously created Module.
  • Select ‘Create module from existing sources’ (importing does not work here)
  • Unselect all the detected modules except Flutter. and select ‘Next’
  • Keep the detected Android module selected and click ‘Finish’

This seems to get the second (or third) Flutter modules attached to the primary project with everything in-sync including separate git remotes. So that’s nice.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Integrate a Flutter module into your Android project
The Android Studio plugin automatically configures your Android project to add your Flutter module as a dependency, and your app is ready to...
Read more >
No Flutter module found - Stack Overflow
1 Answer 1 ... You can create Flutter Module by Flutter cli. ... I used it. But the flutter module isn't showing in...
Read more >
How to add Flutter modules to native iOS project and test it on ...
Creating the Native iOS app · 1. Start Xcode on your system. · 2. Click on Create a new Xcode project. · 3....
Read more >
How to add Flutter to Android App - Level Up Coding
The AAR mechanism creates generic Android AARs as intermediaries that package your Flutter module. This packages your Flutter library as a generic local...
Read more >
How to add Flutter modules to native Android project and test ...
First of all, you have to add two compile options sourceCompatibility & targetCompatibility to the app level build.gradle of the native Android ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found