2

I have three projects, one common widget package and two applications. I have the following directory structure

  • widgets (pubspec.yaml, lib/, ..)
  • app1 (pubspec.yaml, lib/, ..)
  • app2 (pubspec.yaml, lib/, ..)

I can open them in three separate AndroidStudio windows but this has some drawbacks. A refactoring in eg widgets (eg renaming a widget or a function name) is not applied to app1 or app2.

So I'm wondering whether it is possible to open the three projects in a single AndroidStudio window so that refactoring is applied to all projects

Marc Van Daele
  • 2,856
  • 1
  • 26
  • 52
  • 1
    I don't think you can do this! – Usama majid Mar 19 '22 at 17:28
  • Might indeed be the correct answer. I'm sure I'm not the only one with this problem so I'm wondering how others tackle this and how their setup looks like. – Marc Van Daele Mar 20 '22 at 09:26
  • 1
    Try checking this out https://stackoverflow.com/a/32862637/5882307 – OMi Shah Mar 22 '22 at 09:40
  • Thanks for the link! However, this only works when developing for Android I guess. – Marc Van Daele Mar 22 '22 at 10:44
  • Although something similar is possible by using "File/Project structure...", select "Modules" and click "+" and point to the iml file of the module you depend on. This is certainly an improvement though a refactoring in a common library that impacts multiple applications still has to be done manually in the other applications. – Marc Van Daele Mar 22 '22 at 11:26
  • 1
    @OMiShah Your comment pointed me in the right direction so if you convert it to an answer, I can reward you the bounty. – Marc Van Daele Mar 27 '22 at 13:59
  • Thank you for your generosity, but no thanks. I think you can reward me sometimes later or to somebody else. ;) @MarcVanDaele – OMi Shah Mar 27 '22 at 14:04

2 Answers2

1

Apparently, it is possible to have multiple 'modules' open in AndroidStudio where a module can be either a Flutter application or a Flutter package. Hence it is perfectly possible to have the 'widgets' and 'app1'/'app2' open in a single window. This can be done by using "File/Project structure...", select "Modules" and click "+" and point to the iml file of the module you want to add.

Marc Van Daele
  • 2,856
  • 1
  • 26
  • 52
0

Possible duplicate of How do I open two or more projects at the same time in android studio.

Try to go to Settings > Appearance & Behavior > System Settings, in the Project Opening section, choose Open project in new window.

Nedim Karavdic
  • 212
  • 1
  • 2
  • 10
  • If I open them in different windows, a refactoring in one window (eg renaming a widget method) will not have effect in the other window using this widget – Marc Van Daele Mar 22 '22 at 15:30