27

I might sound noob here but I can't see a clear way of opening existing Flutter Project in Android Studio 3.1.2.

I checked this but it didn't work. So I want to know if there is a standard IDE way of doing this? I also can't find any docs clearly mentioning it. Do I need to install a 3rd party plugin?

After opening it as an Existing Android Studio Project, I get the following error:

error

The error is solved by running Get Dependencies. Is it a normal behavior?

9 Answers 9

27
  1. Install Flutter plugin for Android studio: https://flutter.io/get-started/editor/

  2. Open Android Studio

  3. Open existing Android Studio project by using one of below methods:


EASIEST WAY: Drag your project folder and drop to Android Studio.


Other ways:

Android Studio 1

Android Studio 2

Android Studio 3

Sign up to request clarification or add additional context in comments.

7 Comments

I have edited my question. Just want to ask whether Get Dependencies error message is a normal behavior?
Can you click on Get Dependencies on top right? And then run the app? If you can run the app, all is OK I guess
Yes it is solved after that. Though I have to do this when opening any existing project.
Yes, and you have to Get Dependencies again any time that you subsequently change pubspec.yaml (i.e. when you add additional dependencies).
Yes, like when you add dependencies to your build.gradle file in Android project :)
|
25

What works for me was to open existing Android Studio project like mentioned above, and then go to menu

Tools -> Flutter -> Flutter Clean

The configuration window will open and prompt you to locate the Flutter SDK. After locating the SDK, Flutter functions (such as the Pub buttons and Run menu) will be available. You can then proceed to fetch the dependencies by running 'pub get.'

This process essentially cleans the project folder of any previous settings that might conflict with the system (Android Studio). However, this issue won’t occur if you get the project from the source repository, as all junk files will be excluded from the project folder.

1 Comment

Perfect! It is what I was looking for
5

The quickest way on macOS is open -a Android\ Studio android when you are in the root project directory.


Alternatively, if you use the jetbrains toolbox, you can enable "Shell Scripts" in its settings. This will create a binary in the folder of your choice, so you have to add this folder to your PATH. Then, you can use studio . inside the Android folder, or studio android in the flutter project. The benefit of this, is it also works with other Jetbrains products (e.g. charm project_dir or clion project_dir. Unfortunately this method glitches out (for pycharm at least).

Comments

5

Just Open your project as normal, and then in [Android Studio > Preferences > Languages&Frameworks > Flutter > Flutter SDK path] select the path where you downloaded & unpacked Flutter SDK.

Comments

4

Looks like Android Studio can't load Android Application module from Flutter project automatically. I also have same problem, so in my situation Gradle can't be found, because of lack of Android project.

There's important note from official site:

Important: Do not use the New > Project from existing sources option for Flutter projects

I suggest, same is for Open option.

Comments

3

I know it's already late, but you can open an existing Flutter project in Android Studio by following these steps (make sure you have already installed Flutter & Dart plugin and Flutter SDK):

  1. Click Open from File menu in Android Studio,
  2. Go to the path of the project,
  3. Click Open from the dialog,
  4. When the project opens in Android studio, it will show an error of packages and dependencies. So, click on Get Dependencies on the top. Android Studio will automatically add all the required dependencies and packages.

Comments

3

There is a simple way of doing this in android:

Just Open your project as normal, and on the top right corner, click on Flutter Attach option, and voila!

See Attached screen grab!

enter image description here

1 Comment

And then click on the project window... where it says "Android"(upper left corner), and change it to "Project"... Thanks, amigo!
1

Usually you can open your Flutter project in Android Studio simply when you right click on the android folder > Flutter > Open Android module in Android Studio but sometimes this option could be disabled, check this answer to enable..

Comments

0

Working Solution : just run "flutter pub get" in the terminal OR click on Tools->flutter->flutter pub get.(you should have configured the flutter sdk location and plugin). like this

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.