How To Install monkeyrunner on Ubuntu 18.04

In this tutorial we learn how to install monkeyrunner on Ubuntu 18.04. monkeyrunner is Control an Android device using Python

Introduction

In this tutorial we learn how to install monkeyrunner on Ubuntu 18.04.

What is monkeyrunner

monkeyrunner is:

The monkeyrunner tool provides an API for writing programs that control an Android device or emulator from outside of Android code. With monkeyrunner, you can write a Python program that installs an Android application or test package, runs it, sends keystrokes to it, takes screenshots of its user interface, and stores screenshots on the workstation. The monkeyrunner tool is primarily designed to test applications and devices at the functional/framework level and for running unit test suites, but you are free to use it for other purposes.

See also: https://developer.android.com/studio/test/monkeyrunner/index.html

There are three methods to install monkeyrunner on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install monkeyrunner Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install monkeyrunner using apt-get by running the following command:

sudo apt-get -y install monkeyrunner

Install monkeyrunner Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install monkeyrunner using apt by running the following command:

sudo apt -y install monkeyrunner

Install monkeyrunner Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install monkeyrunner using aptitude by running the following command:

sudo aptitude -y install monkeyrunner

How To Uninstall monkeyrunner on Ubuntu 18.04

To uninstall only the monkeyrunner package we can use the following command:

sudo apt-get remove monkeyrunner

Uninstall monkeyrunner And Its Dependencies

To uninstall monkeyrunner and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove monkeyrunner

Remove monkeyrunner Configurations and Data

To remove monkeyrunner configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge monkeyrunner

Remove monkeyrunner configuration, data, and all of its dependencies

We can use the following command to remove monkeyrunner configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge monkeyrunner

References

Summary

In this tutorial we learn how to install monkeyrunner package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.