3

How to import existing Flutter project, as a gradle project? 'Import Project' wizard asking for Gradle home path.

I have gradle, installed in my system. But what (which path) needs to set here.

Here is, what I'm trying:

enter image description here

enter image description here

enter image description here

Error

enter image description here

6 Answers 6

4

I had also gone through this problem where I have to import the existing Flutter project in Android Studio. I was able to import the project following below steps:

  1. Open Android Studio
  2. Goto File -> Open -> In Open File or Project window select the project you want to import.

Once you have done above steps try to resolve warnings shown in the log window. Warnings may be like update dependencies used in the project, etc.

Hope it will help you out.

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

Comments

3

I faced the same issue.

The gradle home directory (on my Windows machine) is located under: C:\Program Files\Android\Android Studio\gradle\gradle-4.1 (please check the gradle version).

This will allow you to open the project. Then, you will most certainly need to "upgrade to gradle".

If this does not fully work, you might also consider using Visual Studio Code, which makes the "import" much easier: simply open the folder where you project resides. Optionally, you will have to resolve missing packages (-> Fetch packages). It should then be possible to run the project.

Hope this helps.

Comments

2
  1. File - Open - Select the project root directory
  2. Open Flutter settings from the tip menu - Click the pull-down menu, then flutter sdk dir appeared
  3. Run

Or you can just use the flutter run command after step 1.

Comments

1

If you first add the flutter plugin for Android studio, then you can directly import the project as an Android Studio project and it should work fine.

Comments

1

In my case, having Android Studio 3.4.2 and Flutter 1.7.8, I only needed to:

1 - Open the project with the option "Open an existing Android Studio project".

2 - Run "flutter pub get" to get the packages listed in the pubspec.yaml file.

3 - Run the project with "flutter run"

If you are using Google services, don't forget to add your google-services.json file in your project. In another case, the project will fail without a clear message when you try to run it.

Comments

-1

For Import exiting Flutter project. Please choose Import Project because of Android Native application mean import use of android app only. So use File -> Open -> Select Project root directory.

After open if ask for dependencies then Choose to Get dependencies

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.