Flutter: How To Import Existing Flutter Project, As A Gradle Project
Solution 1:
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.
Solution 2:
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:
- Open Android Studio
- 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.
Solution 3:
- File - Open - Select the project root directory
- Open Flutter settings from the tip menu - Click the pull-down menu, then flutter sdk dir appeared
- Run
Or you can just use the flutter run
command after step 1.
Solution 4:
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.
Solution 5:
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.
Post a Comment for "Flutter: How To Import Existing Flutter Project, As A Gradle Project"