Syamsul 'isul' Arifin

kartunis dan desainer

Sat, Dec 4, 2021

How to Make AVD With Specific Device From Command Line

terminal

Sometime you want to use not only default avd on your android emulator. You want make avd with secific device for example a tablet. But your laptop is a low-spec machine and not enough to use android studio but quite enough to load android emulator from command line. This is a tutorial to how to make avd with specific device from command line.

The syntax is …

avdmanager create avd -n name -k "sdk_id" -d "device"

Let’s execute the syntax by an example.

  1. Define the ANDROID_HOME.
  2. Define the device target. We can get what device we want to choose by typing in terminal…
avdmanager list

We may got result like this. avdmanager Choose the device. For example “10.1in WXGA (Tablet)”. But I prefer use id, 49.

  1. Define the “sdk_id”. We can get sdk_id that installed on our machine by typing in terminal…
sdkmanager --list_installed

We may got result like this. sdkmanager And the installed sdk_id is “system-images;android-31;default;x86_64”

  1. Define the of avd. For example, “10.1in”.
  2. So we have command like this. Execute in terminal.
avdmanager create avd -n 10.1in -k "system-images;android-31;default;x86_64" -d 49

If successed, we may got notif like this … avd

How to use it?

We can use avd tha we have made by typing syntax …

emulator -avd avd-name

android emulator

So, in our case, the avd name is “10.1in”. So the command just like this

emulator -avd 10.1in

If you forget the avd name, just type command …

emulator -list-avd

How to install apk to the emulator?

It easy to install apk to the emulator. Just drag and drop the apk to the emulator.

comments powered by Disqus