How to Make AVD With Specific Device From Command Line
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.
- Define the ANDROID_HOME.
Define the device target. We can get what device we want to choose by typing in terminal…
We may got result like this. Choose the device. For example “10.1in WXGA (Tablet)”. But I prefer use id, 49.
Define the “sdk_id”. We can get sdk_id that installed on our machine by typing in terminal…
We may got result like this. And the installed sdk_id is “system-images;android-31;default;x86_64”
Define the of avd. For example, “10.1in”.
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 …
How to use it?
We can use avd tha we have made by typing syntax …
emulator -avd avd-name
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 …
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