emulator

package module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2025 License: MIT Imports: 12 Imported by: 0

README

emu

A small yet handy CLI program to make working with Android emulators a bit more pleasant.

Windows isn't currently supported.

Install

macOS

brew tap bartekpacia/tools
brew install emu

ArchLinux

TBD

Features

  • Easily list and run emulators
  • Full shell completion for all commands, flags, and emulator names
  • Change font size and display size
  • Toggle dark mode
  • bonus: doesn't butcher your AirPods sound quality!

Documentation

Overview

Package emulator provides common functionality to manage Android emulators.

Index

Constants

This section is empty.

Variables

View Source
var PrintInvocations bool

PrintInvocations controls whether to print invocations of subprocesses.

View Source
var Serial string

Serial is the serial port of the running AVD, for example "emulator-5554".

Functions

func CreateAVD added in v0.3.0

func CreateAVD(osimage SystemImage, skin string, sdcardMB int) (string, string, error)

CreateAVD creates a new Android Virtual Device and returns its name and path.

It wraps the avdmanager tool from Android SDK.Example AVD manager invocation:

avdmanager create avd \
  --sdcard '8192M' \
  --package "system-images;android-34;google_apis_playstore;arm64-v8a" \
  --name "Pixel_7_API_34" \
  --device "pixel_7"

In addition, it also automatically enables keyboard input.

func DeleteAVD added in v0.3.0

func DeleteAVD(avdName string) error

func DisableAnimations added in v0.2.12

func DisableAnimations() error

func DisableDarkTheme added in v0.2.1

func DisableDarkTheme() error

func EnableAnimations added in v0.2.12

func EnableAnimations() error

func EnableDarkTheme added in v0.2.1

func EnableDarkTheme() error

func SetDisplaySize added in v0.2.1

func SetDisplaySize(value float32) error

func SetFontSize added in v0.2.1

func SetFontSize(value string) error

func Skins added in v0.3.0

func Skins() ([]string, error)

func Start

func Start(name string) error

Start starts the AVD with the given name.

func ToggleAnimations added in v0.2.12

func ToggleAnimations() error

func ToggleDarkTheme added in v0.2.1

func ToggleDarkTheme() error

Types

type AVD

type AVD struct {
	Name    string
	Running bool

	// PID of the emulator process. Equals 0 if Running is false.
	Pid int
}

AVD represents an Android Virtual Device.

It assumes that no 2 instances of the same AVD run at the same time.

func List

func List() ([]AVD, error)

List returns a list of available AVDs and whether they're running or not.

func (AVD) Describe

func (a AVD) Describe() string

type SystemImage added in v0.3.0

type SystemImage string

SystemImage is a unique identifier of an Android OS image .Examples:

  • system-images;android-34;google_apis_playstore;arm64-v8a
  • system-images;android-35;google_apis;x86_64

func SystemImages added in v0.3.0

func SystemImages() ([]SystemImage, error)

SystemImages returns installed Android system images.

func (SystemImage) ApiLevel added in v0.3.0

func (s SystemImage) ApiLevel() string

ApiLevel returns the API level of this system image. Error can be returned when e.g. the new Android version still has only a codename, not a number.

Directories

Path Synopsis
cmd
emu

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL