Emulators and virtual machines today are hard to surprise anyone. Often this is no longer the system administrator’s tool, which in a sweater and with a beard tames demons. Emulators are used by developers and gamers. They test Android applications before they are released – it’s easier than having a dozen smartphone models on hand.
Today we’ll talk about how you can run Android applications on Linux, namely in the Ubuntu 18.04 operating system. It turns out there are several ways to do this.
The content of the article:
1. INSTALL ANBOX EMULATOR
The first method to run an Android application on Linux is to use Anbox. This is an open source Android emulator that is installed by several teams and allows you to run Android applications on Ubuntu.
First, go to the terminal and update the list of packages with the following command:
sudo apt-get update
After that, we begin the installation of Anbox. First, connect the repository:
sudo add-apt-repository ppa:morphis/anbox-support
When the system asks – press Enter. Once again, we update the package list:
sudo apt update
After that, install the Anbox core
sudo apt install anbox-modules-dkms
After installation, you need to manually start the kernel modules once. In the future, they will start by themselves.
We carry out:
sudo modprobe ashmem_linux
sudo modprobe binder_linux
Install Android Debug Bridge. It is needed for the correct operation of Android applications:
sudo apt install android-tools-adb android-tools-fastboot
Now install, in fact, Anbox. It is important to note that while this is a beta version, therefore errors are possible in it.
And the installation is made in the form of snap-, not classic packages. We execute in the terminal:
snap install --devmode --beta anbox
It is unlikely, but the system may swear “snap not found”. Install snap with the command:
sudo apt install snapd
And try again. During installation, a password will be requested.
2. USING ANBOX EMULATOR
After installation, you can add or remove files with the extension. APK. These are installation packages for Android programs.
To install the Android program on Linux, use:
sudo adb install /the/location/of/file.apk
To delete, respectively:
sudo adb uninstall /the/location/of/file.apk
You can start Anbox both from the list of programs and from the terminal:
3. INSTALLING THE GENYMOTION EMULATOR
The second emulator is very interesting today. To begin with, he is cloudy. Secondly, it is paid for commercial use. Although in our case, a free license is enough.
Finally, Genymotion offers emulation of ready-made models of smartphones and tablets, which is very good for developers. You can immediately test the program in different modes.
First, go to the Genymotion website , register there and receive a confirmation email about registration. In it, click on the link to confirm the address and activate the account.
After we click on the red Trial button in the upper right corner.
We are transferred to a new page from where you can download the necessary file. In our case, it is a file with the bin extension. We start the download, and while it goes, install VirtualBox (if suddenly it is not installed).
In the terminal we type:
sudo apt install virtualbox
Press Enter, enter the password, when the system asks for confirmation, press y . At the end of the installation, we type in the terminal:
This command will list the directories. We need Downloads or the one where your files are downloaded by default. Enter:
Hit Enter, we are transferred to the folder. Enter again:
This gives us a list of files in the folder. We are interested in genymotion-2.12.1-linux_x64.bin (in the case of a 32-bit system, genymotion-2.12.1-linux_x32.bin). Enter:
sudo chmod +x genymotion-2.12.1-linux_x64.bin
Here you can enter the first letters of the file name and press Tab . Hit Enter. Otherwise, you can do this by going to the Downloads folder, right-clicking on the file and giving it permission to execute.
After that install:
Press Enter, then y , then:
By pressing Enter, the program starts. Now select Sign in and log in with the data with which we registered on the site. You can immediately select Personal Use and log in already there.
We accept the conditions of EULA and – voila! We have a ready-to-use system. Now you know how to run an Android application on Linux.
4. RUNNING ANDROID APPLICATIONS ON GOOGLE CHROME LINUX
The browser uses a number of extensions for this – chromeos-apk and ARChon. Emulation itself works using the Chrome App Runtime library. It originally appeared on Chrome OS when Android support was added there. To begin with, we install the unstable version of Chrome (before release). In the Terminal we perform:
sudo nano /etc/apt/sources.list.d/google-chrome.list
A Nano window will open, enter the following there:
deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
Write changes a combination of the Ctrl + About , leave – the Ctrl + the X . Important! When exiting without pre-recording, data is not saved!
Next, in the terminal, enter:
This command will download the key to access the deb package. Now enter the command below, this will add the key:
sudo apt-key add linux_signing_key.pub
Updating the list of packages:
sudo apt update
After that, install the already unstable version of the browser:
sudo apt install google-chrome-unstable
The first launch of the browser will be long, this is normal. You can set it by default if you want.
- After starting, download and extract the contents of ARChon from the archive into any directory (even possible by default);
- We open Chrome and in the settings we activate Developer mode . To do this, go to chrome: // extensions / or open a menu (which has three dots);
- Click on Load unpacked extension and specify the unpacked ARChon. After that, the extension is installed.
However, that is not all. Now you need to prepare the APK for installation (and you thought everything would be easy?). First install the chromeos-apk extension. To do this, install the lib32stdc ++ 6 library with the command in the terminal:
sudo apt install lib32stdc++6
We install chromeos-apk using the npm package manager in the same terminal:
npm install chromeos-apk -g
Done, now you can correctly unpack the APK using chromeos-apk and translate it into an extension. In the terminal, enter the command:
We got the extension for the Chrome browser. Open it in chrome: // extensions /, and then run it. If you did everything right, a brand new program should start.
It is important that not all applications will work in this option. After all, in fact, this is still a test feature, not a release. Most likely, games, system applications, and simply “heavy” programs will not start.
In general, there are many more ways to run Android programs on Ubuntu. You can use the Shashlik emulator or even install Android x86 in VirtualBox. You can use QEMU and even emulate iron (provided that you have a powerful PC). In the end, if you have a lot of free time, you can even experiment with the Wine + bunch of any-emulators-under-other-OSs. True, no one will give job guarantees 😊.
Seriously, there are solutions for Ubuntu 18.04 for working with Android applications. It remains to choose.