Duplicate Flutter project using Android Studio

Image source: Flutter.dev

Here’s a straightforward way to duplicate a Flutter project folder into a new project. This has been tested using Android Studio 4.1.3 on Windows 10.

  1. Open into Android Studio the existing Android app project you would like to duplicate. Let’s call this project folder old_flutter_project.
  2. While the project is still open, find and copy the project folder location in your drive. Let’s assume I save this project folder as D:\Lorna\flutter\projects\old_flutter_project, so I right-click on the old_flutter_project folder and select Copy.
  3. Paste the folder into the location you choose. I recommend that you save in the same location along with your other Flutter project folder so that you can easily find and do backup. In my instance, once pasted, I now have the following folders:-
    • D:\Lorna\flutter\projects\old_flutter_project
    • D:\Lorna\flutter\projects\old_flutter_project - Copy
  4. Rename the new folder you pasted. I recommend that you rename it in the same way you want to call your project. For this example, once I renamed it to new_flutter_project, my folder content looks like this:-
    • D:\Lorna\flutter\projects\old_flutter_project
    • D:\Lorna\flutter\projects\new_flutter_project
  5. Go into the new folder and delete the .idea folder. In my example, my new folder contains the following:-
    • D:\Lorna\flutter\projects\new_flutter_project\.idea
    • D:\Lorna\flutter\projects\new_flutter_project\old_flutter_project
      So I deleted the .idea folder, leaving just old_flutter_project folder inside.
  6. Open the new project folder in Android Studio. At this time, you may also close the old Flutter project from Android Studio. I recommend that you use the Open an Existing Project option from the Android Studio startup wizard, although opening it via File > Open should be fine, too.
  1. Once your new project is loaded and analyzed, you will get a Framework Detected notice. Select Configure and click OK.
  1. At this point, Android Studio shows the whole Android framework of your new project folder. In the Project view, click the dropdown arrow and select Project. This will display your new project root folder.
Related post:  Musings on my Web development v.2022
  1. Right-click on the project folder root and select Refactor > Refactor This… > Rename… .
  1. Type in your new project name and click OK. I recommend that your folder and project names match so that you can easily identify them later. For my example, I type new_flutter_project.
  2. Select File > Save All.

–END

Will this work with all other non-Flutter projects on Android Studio? I’m not sure, as I haven’t tried. Nevertheless, the steps I describe above is similar to a Stack Overflow’s answer about copying an Eclipse project in Android Studio.

I hope this technique helps you. Happy Fluttering!

Spread the love

Check out my other posts: « / »

Posted on 29 March, 2021 under Life at work and tagged with , , , ,