Open In App

How to Run a Flutter App on Android Emulator?

Improve
Improve
Like Article
Like
Save
Share
Report

An emulator is a virtual device created to run programs/applications derived from the host system. An Android Emulator imitates an android device and is used to run and test android applications on your host system without requiring the presence of a physical android device. To run your flutter applications on an emulator is a bit of a task if you are not well-versed with the android studio already. In this article, we will walk you through the procedure to run your flutter app on an Android Emulator. You can run your flutter application on an android emulator using three simple steps:

  1. Installation 
  2. Connection
  3. Running 

Given below is a detailed explanation of these steps one by one.

Step by Step Implementation

1. Installing the Emulator 

Open SDK Manager: Open your android studio and click on the “SDK Manager” option that appears in the center of your system screen under the More Options tab.

 

Select Tools: After clicking the SDK manager, you will be directed to the Android SDK tab. Select the “SDK Tools tab“, check the following given options and click “OK“. 

  • Android SDK Command Line Tool
  • Android SDK Platform Tool
  • Android Emulator 
  • Google USB Driver 

Your installation for the requested components will start.

 

Finish the Installation: Press “Finish” option in the bottom right of your screen after your installations are completed .

 

Open Virtual Device Manager: Open the “Virtual Device Manager” in the center of the screen just below the SDK manager option.

 

Create Virtual Device Manager: Click on the “Create Virtual Manager” provided exactly in the middle of the screen. A dialogue box for hardware selection will pop up. 

 

Select Hardware: Select the type of android emulator you want to select and proceed to the next page. 

 

Select System Image: Select a system image to be displayed for your android emulator, verify the configuration and finish the set up. Your virtual device is ready to use. 

 

2. Creating Connection 

Choose Device: Open your VS Code and from the bottom right corner of your home screen click on the Flutter Device option.

 

Select Device: When you click on the Flutter Device icon, list of available devices will open up in the command palette. Select the emulator you just created.

 

Process the emulator: The processing for opening the emulator will start. It may take a few seconds to wait until it opens up.

 

Launched Emulator: Your android emulator is now ready for running your flutter application. 

 

3. Running Your Application 

Start debugging: Select the “Run without debugging” option in the “Run” tab after your emulator starts.

 

Launching Emulator: Your selected emulator will be launched, and will present the output of your flutter code.  

Sample Code

Given below is a flutter code implementation and a video tutorial for the same. 

Dart




import 'package:flutter/material.dart';
 
void main() {
  runApp(MyApp());
}
 
class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
 
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('GeeksforGeeks'),
          backgroundColor: Colors.green,
        ),
        body: Center(
          child: RaisedButton(
            padding: EdgeInsets.all(5),
            color: Colors.green,
            child: const Text(
              ' Hola Geeks!! ',
              style: TextStyle(color: Colors.white),
            ),
            onPressed: () {},
          ),
        ),
      ),
    );
  }
}


Below is a sample video explaining all the steps:



Last Updated : 25 May, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads