How to make Virtual Device in Android Studio Faster

We want the Virtual Device to test our Flutter Application. However, to create the virtual device we have to install the Android Studio. After that, we can launch the Virtual Device from the Android Studio, and as well as from the Visual Studio Code Editor.

We can always test our Flutter App with the help of a real device. But, while we build a Flutter App, we need to take the advantage of Hot Reload. And for that reason, the Virtual Device is the best option.

All said and done, it is also important that our Virtual Device in Android Studio should run faster.

However, the million dollar question is, how we can make it run faster?

Before we jump in to the main topic, let us check a few basic things firstly.

How to install Android Studio?

Installing any IDE in Windows is comparatively easy. Download the “.exe” file from the official web site and double-click to launch it.

This is recommended. You can also download the ZIP file and unpack it to the program files. You will find the android-studio bin folder where you can launch the respective “.exe” files.

However, downloading the “.exe” file from the official web site and launching it online is recommended.

Installing Android Studio on MAC is not a complicated process.

You need to launch Android Studio DMG file and then drag and drop the Android Studio into the Applications folder. After that, the launching process is easy.

The set-up Wizard will guide you through the rest part. For development, you need to download the Android SDK components.

I will recommend to use Linux as the main operating system. My favourite is Ubuntu for general purpose.

Why?

Because Android as a framework will always execute better on top of the Linux Kernel.

Installing Dart SDK in Linux is also easy.

Why do we need the Dart SDK?

Because it has the libraries and command-line tools that we need to develop all kinds of Dart applications, web, command-line or server apps.

To install Dart, first open your terminal, and then you can issue the following commands:

sudo apt-get update

     sudo apt-get install apt-transport-https

     sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'

     sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'

After that, install the stable release of the Dart SDK.

sudo apt-get update

sudo apt-get install dart

Let us check the Dart version so that it must be the updated one.

$ dart --version
Dart SDK version: 2.15.1 (stable) (Tue Dec 14 13:32:21 2021 +0100) on "linux_x64"

Install Android Studio in Linux

Installing Android Studio on Linux, is quite simple and user friendly.

You don’t have to issue any command-line instructions.

Download the ZIP file and unpack it to either “/usr/local/” or “/opt/” for shared users.

Now, navigate to the “/android-studio/bin/” directory and execute the “studio.sh” file with the help of this command:

./studio.sh

If it asks to install the required libraries for 64-bit Linux machines.

According to the instruction, install it.

If you are a first time user of Android Studio, you can import previous Android Studio settings.

Or, you may skip it by clicking the OK button.

The Android Studio Wizard will guide you to set it up; remember, this set-up includes downloading Android SDK components.

It is required for development. Moreover, in the configure section you can install Flutter and Dart plugins.

To get maximum of Android Studio in a 64-bit Linux machine, we need to install some 32-bit libraries.

The following command-line instructions will work for us.

sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386

The command will ask for the root password. For the 64-bit Fedora, the command is different.

sudo yum install zlib.i686 ncurses-libs.i686 bzip2-libs.i686

Now, we are ready to work in Android Studio.

How to create a Virtual Device in Android Studio?

You can find the “Device Manager” option under the “Tools” menu.

Android Studio Device Manager
Android Studio Device Manager

Once we click the “Create Device”, it will ask to choose the device definition. In Category we will choose the “Phone”, and as our Virtual Device we will opt for Nexus 6.

Android Studio_ select the name Nexus 6
Android Studio_ select the name Nexus 6

The next part is tricky.

Why?

Because, now we have to choose the correct Operating System. We should remember that an Android device might have different sizes.

Therefore, choosing a lower version is always the best option. The reason is simple. Most of the Android Phone buyers come from the poor or middle class background. They cannot afford to buy high definition Android Phone that runs the latest Android version.

If we check our Flutter Application in a lower version, we will always be safe.

Therefore, we would select the following Android version.

Android Studio selecting the Operating System
Android Studio selecting the Operating System

Now the final moment is going to come.

We are going to choose the “Graphics” part. In this place most users opt for the “Automatic”.

Never do that. Always choose the Hardware section, so that our Virtual Device runs faster.

Android Studio select the Graphics to Hardware to run the device faster
Android Studio select the Graphics to Hardware to run the device faster

Finally, click the “Finish” button. And congratulation, you have successfully installed the correct Virtual Device which will run Faster than the Real Device on any operating system.

What Next?

Books at Leanpub

Books in Apress

My books at Amazon

Courses at Educative

GitHub repository

Technical blog

Twitter

Comments

2 responses to “How to make Virtual Device in Android Studio Faster”

  1. […] we try to compile our Flutter App in our Virtual Device, we face a common error. It reads: Your project requires a newer version of the Kotlin Gradle […]

  2. […] After that, we will run the same Flutter App in the Android Virtual Device. […]

Leave a Reply