How do I migrate my Flutter project from vscode to Android Studio? - android-studio

I created my Flutter project by typing into my CLI Flutter create project_name and all this time I've been coding using VScode, and the project is near completion, which means I have to do a software demo in the coming days to my professors in university. However, I would need to open multiple android emulators that will run the same project, based on my brief research and testing, VScode does not allow running multiple android emulators that run the same project. So I have to transfer that project from VScode to Android Studio.
I've tried simply opening my Flutter folder in Android Studio and I'm getting gradle build errors. Any help would be appreciated thank you!

As long as you have the Flutter plugin installed in Android Studio, you can just open the folder like any other.
Though FWIW, I don't know if Android Studio supports debugging on multiple devices at the same time. It does work in VS Code (as shown at Flutter Interact with the "Flutter Octopus") if you're on the master channel (see https://github.com/flutter/flutter/wiki/Multi-device-debugging-in-VS-Code).

Related

Flutter UI Guides not showing in Android Studio

In Android Studio V4.1.3 (build no. Al-201.8743.12.41.7199119) The Flutter UI guides for widgets and methods not showing at all even though it is enabled in the settings. Please, be kind to see the screenshot =>
no Flutter UI guides
I have Flutter Plugin V55.1.1 and Dart Plugin V201.9335 installed.
All your help is highly appreciated.
Thank you
You might be creating the new Flutter project and selecting Java for Android. But when you select Kotlin and create project. The issue will be fixed.
And if you want your old projects to be converted to Kotlin, just open the terminal in that project and run this
run flutter create -a kotlin .
The dot(.) at the end is also important it will generate the Kotlin files in current directory.
After this, just re-open the project, you'll get the guides.
I have the same android studio version as you and Flutter Plugin V55.1.1 and Dart Plugin V201.9380 installed. Getting the same issue. I have even tried to enable and disable the "Show UI guidelines for build methods" in Setting > Language & Frameworks > Flutter, but nothings work.
I cloned flutter/sample from GitHub and it seem that the UI guides is showing on that samples project.
My current (kinda easy cheat) solution right now is by creating a New Flutter application project via VS Code. And when I open that flutter project on Android studio, the UI guides is there. I have configure my VS Code with the recommended setting for Dart code.
Tutorial to configure your VS Code reference: https://youtu.be/nAmOt5_fMtU?t=278
I'm pretty new in flutter development but I'm pretty sure there might be something that we can configure on Android Studio seeing that generated project file from VS Code does shows the UI guideline. If someone know how do let me know. Cheers!

How to test Flutter app made from Android Studio on iPhone

As you can tell from the question I'm a newbie to Flutter world. I just finished making a simple Flutter app using Android Studio IDE, and would like to test on my iPhone. Is there a way to do this from within Android Studio? If not, do I just use Xcode? Any detailed instruction would be appreciated!!
You can find how to run an app from Android Studio in Official Flutter Documentation. Also, for run and test your iOS app, you need Mac computer.

Not able to run Emulator using the Android studio for my Flutter app, getting NO CONNECTED DEVICES error

Please Note: I tried several available solutions but none worked for me since yesterday hence posting this. I have also mentioned below what are things I have tried so far.
I am new to Android Studio and Flutter application and I am trying to build a simple Flutter app using the Android Studio.
I have downloaded and kept my flutter files in C:\src\flutter. Also added to Environment variables.
I have installed the Android Studio and also installed the Flutter plugin with the Dart.
I created the Virtual Emulator Device using the Tools->AVD Manager and choose the Nexus 6 with the Android 8.1
Created a simple project using the File->New Flutter Project->Flutter Application.
When I try to run this application I get the following error:
As you can see in the screenshot it shows that the No Devices in the emulator section not sure how to run it.
Things I have tried so far:
If I run flutter doctor then I get a tick for all the things except Connect Devices. My guess is that it is obvious because I have not connected any external device but using the emulators.
I tried to create the emulators using the command flutter emulators --create Nexus_6 and tried to launch it using the command flutter emulator launch.
I tried running the Android studio as an Administrator.
Restarted the system several times.
My adb.exe was crashing so updated the windows and replaced it with the new adb.exe as mentioned in one of the solutions.
My flutter emulators show following list in the command prompt:
I tried checking the folder in Appdata -> Local seems to be fine as per other mentioned answers.
When I run the Emulator using the AVD Manager from Android Studio I see that it is firing up the Android Emulator but it is not responding. In addition to this, I also observe in my task manager that process adb.exe(32 bit) is running whereas my WINDOW 8.1 is 64 bit. Is this expected?
I am not sure If I missed something here. Please help me on how to solve the issue.
Using below command on Flutter worked for me:
flutter config --android-sdk [android-sdk-path]
The path is usually C:\Users<username>\AppData\Local\Android\sdk
this path can be found from android studio - SDK manager also.

Flutter project import Android studio

So im new to flutter and wanted to check out an example project to see how its set up architecure wise. For this i stumbled upon InKino. Looks like a nice app to check out as example.
https://github.com/roughike/inKino
When i open Android Studio > file > Open... and select the folder that i have cloned previously it somehow does not detect that its a flutter project. And cant seem to run it
However when creating a new flutter project everything is working fine and i can run my project as per usual.
I have installed latest flutter and dart plugins for Android Studio. Also the flutter SDK and Dart sdk are installed.
I downloaded the repository you linked and my Android Studio identified the project as flutter project. What I did is opening the mobile sub folder not the whole repository folder, because the repository contains multiple different type of projects.

How to set the project type to Flutter in Android Studio

I'm having a problem understanding how to configure a Flutter project in Android Studio. I've done all the Flutter/Dart install steps and I can successfully build Flutter projects. My problem is setting the project so the Project View window in Android Studio sees my projects as Flutter projects and not an Android project. For example, here's a screenshot of a Flutter project I created:
Android Studio Project View Java folder
Notice the Java "coffee cup" on the flutter_app folder and the "[flutter_app_android]" on the android folder. Here's an example of a Flutter project that seems to correctly be identified as a Flutter project in Android Studio:
Android Studio Project View Flutter folder
I've tried creating new Flutter projects in Android Studio and by the flutter create command line. This is driving me nuts and is probably something trivial but I can't find the setting that makes my project recognized as a Flutter project.
Actually I typically use the project view as you have shown in your first image. The Flutter code is in the lib folder. Being able to see the 'android' and 'ios' folders can be helpful if you need to configure something specific like Firebase Cloud Messaging or you need to add channels to your Flutter app to call native iOS or Android code.

Resources