MEmu Command (MEMUC) Reference Manual

GOOD NEWS for Geeks and Programmers!!

Since MEMU Android Emulator 6.0, MEmu supports a new full-functional command MEMUC. It is designed to replace all other command interfaces like memu, memumanage, memuconsole and adb. So read this article and you will know everything about this powerful command.

memuc supports to manipulate multiple instances (VMs) such as reboot emulator, check status, install apk, run app and etc. First of all, you need to pass over the index or the name of the target VM. For example:
memuc clone -i 0 (or –index 0) //The 1st VM index is 0, 2nd is 1, 3rd is 2 …
memuc remove -n MEmu_2 (or –name MEmu_2) //The 1st VM name is MEmu, 2nd is MEmu_1 …

 

The MEMUC command is divided into four categories:

emulator management“, “emulator configuration“, “emulator control“, and “adb command“:

Emulator management: It mainly involves the startup and shutdown of the emulator, import and export, creation and deletion, running status query, etc. Except for a few operations such as cloning and renaming, there is no need to specify the instance when calling

Emulator configuration: mainly involves the modification of the emulator properties, and the emulator needs to be specified when calling

Emulator control: mainly involves the control of the Android system, such as installing the app, starting/closing the app, disconnecting the network, etc. The emulator needs to be specified when calling

ADB command: It is mainly to package the official adb command-line tool of Android to solve the problem of connecting to a specific emulator (avoid entering a random IP when using a bridge network), and you need to specify the emulator

 

 

MEMUC Reference Manual

[Chapter One] VM Management

  1. Create a new VM
    • Usage:     memuc create
    • memuc create 44    //create a certain version of Android
      memuc create 51
      memuc create 71
    • memuc create 76  (Android 7.1 64-bit)
    • Sample:   memuc create //Create a new VM
  2. Delete a existed VM
    • Usage:     memuc remove <-i vmindex | -n vmname>
    • Sample:   memuc remove -i 0 //Delete the MEmu VM
  3. Clone a existed VM
    • Usage:     memuc clone <-i vmindex | -n vmname> [-r nametag] [-t]
      [-t] Return without waiting for the end of the task, and get the task id number
    • Sample:   memuc clone -i 1 //Clone the MEmu_1 VM
  4. Export/Backup a VM to a file
    • Usage:     memuc export <-i vmindex | -n vmname> <ovafile> [-t]
      <ovafile> Export to ova file type
      [-t] Return without waiting for the end of the task, and get the task id number
    • Sample:   memuc export -n MEmu_1 c:\1.ova //Export MEmu_1 VM to 1.ova file in C drive
  5. Import/Restore a VM from a existed ova file
    • Usage:     memuc import <ovafile> [-t]
      <ovafile> ova file type
      <memufile> memu file type (supported by 7.1.3 version and later)
      [-t] Return without waiting for the end of the task, and get the task id number
    • Sample:   memuc import c:\1.ova //Import a VM from 1.ova file in C drive
  6. Start a existed VM
    • Usage:     memuc start <-i vmindex | -n vmname> [-t]
                       [-t] Return without waiting for the end of the task, and get the task id number
    • Sample:   memuc start -n MEmu_2 //Start the MEmu_2 VM
  7. Stop a running VM
    • Usage:     memuc stop <-i vmindex | -n vmname> [-t]
                       [-t] Return without waiting for the end of the task, and get the task id number
    • Sample:   memuc stop -n MEmu //Stop the MEmu VM
  8. Stop all running VMs
    • Usage:     memuc stopall
    • Sample:   memuc stopall //Stop all the running VMs
  9. List information of all VMs
    • Usage:     memuc listvms [–running] [-s]
                       [–running] List information of all running VMs
    • Sample:   memuc listvms //List information like index, title, window handle, status, pid.
    • Sample:   memuc listvms -s //Display disk information
  10. Check whether VM is running or not
    • Usage:     memuc isvmrunning <-i vmindex | -n vmname>
    • Sample:   memuc isvmrunning -n MEmu_3 //Check whether VM is running or not
  11. Sort out all VM windows
    • Usage:     memuc sortwin
    • Sample:   memuc sortwin //Sort out all VM windows
  12. Reboot VM
    • Usage:     memuc reboot <-i vmindex | -n vmname> [-t]
                       [-t] Return without waiting for the end of the task, and get the task id number
    • Sample:  memuc reboot -i 0 //Reboot VM
  13. Rename VM
    • Usage:    memuc rename <-i vmindex | -n vmname> <title>
    • Sample:  memuc rename -i 0 “MEmu_1” //Rename VM
  14. Check asynchronous task status, like clone, export, import, start and stop.
    • Usage:     taskstatus <taskid>
    • Sample:   taskstatus 7baf735f-c877-4836-aaf9-ccca67296a8f //Check the status of task 100, it will return success, running, or failed.

 

[Chapter Two] VM Configuration

  1. Get configuration data of VM
    • Usage:     memuc getconfigex <-i vmindex | -n vmname> <key>
                      <key> configuration key name
    • Sample:   memuc getconfigex -i 0 memory //Get the memory size of MEmu VM
  2. Set configuration data of VM
    • Usage:     memuc setconfigex <-i vmindex | -n vmname> <key> <value>
                      <key> configuration key name
    • Sample:   memuc setconfigex -i 0 cpus 4 //Set the number of CPU core as 4

configuration key table
configuration key table

[macaddress] //Device MAC address
[cache_mode] // Cache mode, 1 is acceleration (good performance, but there is a risk of damage to the image when the power is off accidentally), 0 is stable (the image file is not easy to be damaged, and the performance is slightly worse)
[geometry (x y width height)] // Top left coordinate and size of simulator
[custom_resolution (width height dpi)] // Android resolution and dpi
[disable_resize] // Fixed window size, 1 is fixed, 0 is stretchable
[ssid (uylnhxb557|auto)] // WIFI name (auto stands for automatic generation)

 

[Chapter Three] VM Control (when VM is running)

  1. Install Apk in VM (Android)
    • Usage:     memuc installapp <-i vmindex | -n vmname> <apkfile> [-s]
                      <apkfile> apk filepath
      [-s] Create a shortcut on the desktop after installation (7.1.3 version and later)
    • Sample:   memuc installapp -n MEmu_1 c:\test.apk //Install test.apk into MEmu_1 VM
  2. Uninstall App from VM
    • Usage:     memuc uninstallapp <-i vmindex | -n vmname> <packagename>
                      <packagename> app package name
    • Sample:   memuc uninstallapp -i 1 com.microvirt.test //Uninstall this app from MEmu_1 VM
  3. Start App in VM
    • Usage:     memuc startapp <-i vmindex | -n vmname> <packageactivity>
                      <packageactivity> app main activity
    • Sample:   memuc startapp -i 1 com.android.settings/.Settings //Start Android settings in MEmu_1 VM
  4. Stop App in VM
    • Usage:     memuc stopapp <-i vmindex | -n vmname> <packagename>
                      <packagename> app package name
    • Sample:   memuc stopapp -i 1 com.android.settings //Stop Android settings in MEmu_1 VM
  5. Trigger Android keystroke
    • Usage:     memuc sendkey <-i vmindex | -n vmname> <key>
                      <key> back | home | menu | volumeup | volumedown
    • Sample:   memuc sendkey -i 0 home //Trigger home key in MEmu VM
  6. Trigger shake
    • Usage:     memuc shake <-i vmindex | -n vmname>
    • Sample:   memuc shake -i 1 //Trigger shake in MEmu_1 VM
  7. Connect internet in Android
    • Usage:     memuc connect <-i vmindex | -n vmname>
    • Sample:   memuc connect -i 2 //Connect internet in MEmu_2 VM
  8. Disconnect internet in Android
    • Usage:     memuc disconnect <-i vmindex | -n vmname>
    • Sample:   memuc disconnect -i 2 //Disconnect internet in MEmu_2 VM
  9. Input text to Android
    • Usage:     memuc input <-i vmindex | -n vmname> <text>
    • Sample:   memuc input -i 0 “Hello World!” //Input “Hello World!” text into MEmu VM
  10. Rotate VM window
    • Usage:     memuc rotate <-i vmindex | -n vmname>
    • Sample:  memuc rotate -i 0 //Rotate the first VM
  11. Execute command in Android
    • Usage:     memuc <-i vmindex | -n vmname> execmd <guestcmd>
    • Sample:   memuc -i 1 execcmd “getprop persist.sys.language” //Execute “getprop” command to get Android language in MEmu_1 VM
  12. Change GPS latitude and longitude
    • Usage:     memuc setgps <-i vmindex | -n vmname> <longitude> <latitude>
    • Sample:  memuc setgps -i 0  30.978785 121.824455 //Set current longitude 30.978785, latitude 121.824455
  13. Obtain the public IP address
    • Usage:    memuc -i 0 execcmd “wget -O- whatismyip.akamai.com”
  14. Zoom in (Supported by version 6.2.6 and later)
    • Usage:    memuc zoomin <-i vmindex | -n vmname>
    • Sample:  memuc zoomin -i 0 //Zoom in the content
  15. Zoom out (Supported by version 6.2.6 and later)
    • Usage:     memuc zoomout <-i vmindex | -n vmname>
    • Sample:  memuc zoomout -i 0 //Zoom out the content
  16. Get a list of third-party apps in the emulator (supported by 7.1.3 and later)
    • Usage:     memuc getappinfolist <-i vmindex | -n vmname>
    • Sample:  memuc getappinfolist -i 0 //Show the third-party app list of MEmu
  17. Set the value of acceleration of gravity (supported by 7.1.3 and later)
    • Usage:    memuc accelerometer <-i vmindex | -n vmname> <-x xvalue> <-y yvalue> <-z zvalue>
    • Sample:  memuc accelerometer  -i 0 <-x 0.0> <-y 8.9> <-z 4.5> //Set the gravity acceleration value to 0, 8.9, 4.5
  18. Create desktop shortcuts for Android applications (supported by 7.2.5 and later)
    • Usage:    memuc createshortcut <-i vmindex | -n vmname> <packagename>
    • Sample:  memuc createshortcut -i 0  com.android.settings //Create a desktop shortcut for the Settings app

 

[Chapter Four] ADB command

Most likely you don’t need ADB command any longer because memuc execmd supports most of Android commands. In addition, memuc execmd doesn’t depend on ADB server which means more stable. However, memuc adb is still supported just in case you need a specific adb command for some reason.

  • Usage:     memuc <-i vmindex | -n vmname> adb <adbcmd>
  • Sample:   memuc -i 0 adb “remount” //Execute “remount” command through ADB connection

[END]

 

 


Discover More about MEmu Play