-
Notifications
You must be signed in to change notification settings - Fork 2
Mobile App Emulation with Android Studio and Flutter
farukyld edited this page Dec 28, 2023
·
20 revisions
Steps To Prepare Your System For Running Mobile Application In The Android Studio Emulator
**Installing Android Studio and Android SDK
- Install Android Studio (Giraffe or later suggested)
- Enable installation of android virtual device:
- if you see this screen, continue with it:
- if you see this screen, go with more options > SDK manager:
- in the SDK Manager screen, make sure Android API 34 is checked (if not, install it from this screen. similar to all jetbrains IDEs):
- Set your ANDROID_HOME variable to the folder that sdk is installed:
- and from the SDK Manager window, install android sdk command line tools. tick it and click apply as we did for android API 34:
** Installing Flutter
- Install flutter.
- Select your OS. Let's continue with windows as example.
- Then select mobile as target platform.
- Scroll down to this section.
- download the zip, extract it to somewhere not requiring privileged access. This is your flutter sdk
- add
<flutter sdk path>/bin
to your PATH variable. - run this command:
flutter doctor --android-lisences
- type
y
when asked.
**Opening Mobile App
- After cloning the repo, Open Project:
- go to Tools > SDK Manager set your flutter SDK path:
- then set your dart sdk path (it is flutter/bin/cache/dart) and enable dart support for project:
- then run this command in the project directory:
flutter pub get
- now it is time to create a virtual device using Android Studio VDM, and run our application in it.
- after clicking on create, select the resolution (1:2 or 9:16 suggested):
- then select the API 34 from recommended tab in this window download if required:
- continue with portrait in the next screen, and finish:
- after that, your newly created android device should be listed here:
- you can run it from inside android studio window. but I recommend running it as a floating window. I do it in that way:
-- File > Close Project
-- More Options > Virtual Device Manager
-- run it:
- then open the project again
- android studio will automatically detect the running virtual device, (orange) the
lib/main.dart
file (red). click run (purple). The first run may take more than a minute to launch the app.
- enjoy the app