Running Android apps in Linux
I have a Red Hat Linux (RHL) system on which I’d like to run Android apps. How would I do this? Is there an open-source port of the Android Runtime for linux? Kind of like a VM? If not, what steps will I need to follow to port the runtime to RHL (with the Dalvik VM etc) so that I can run the android apps built by all android developers? I am new to android so I am trying to understand if there is an application virtualization support for it from anyone. Thanks in advance!
You will be able to run them, it’s working in progress. And this feature will bring Linux to desktops. Stay tuned!
@lzap That’s exciting!! Could you give us a little more detail? For example what is the name of the project, and who are behind it? Thanks!
4 Answers 4
You need to use dex2jar to convert an APK file to a JAR and then you need IcedRobot to run the Android stack above OpenJDK. Maybe I will try to emulate AndroidGL with JOGL 2.0 (it supports both OpenGL and OpenGL-ES). Keep in mind that it is not trivial.
The emulator of Android SDK is quite slow but you just have to enter adb install my_file.apk to install your application.
You can run android-x86 in VirtualBox or Live Android from a Live CD as Dimitri suggested but I’m not sure it is what you want.
P.S: The most promising solution seemed to be AndroVM.
P.S 2: ARChon Runtime works very well on 64-bits systems. This tutorial is very helpful to make it work.
P.S 3: App Runtime for Chrome Welder is even more promising, it’s currently in beta. The final version will support all Android APIs in Google Chrome under GNU Linux (including Chrome OS), Mac OS X and Windows.
How to run Android Apps in Linux without an Emulator
U sually, a standard android app is generated for a tablet PC or smartphone running on the Android OS. Still, this guide will explicitly show you how to set it up on your Linux machine without using an emulator.
Linux, on the other hand, is an open-source operating system. An operating system is software that directly interlinks and manages a system’s hardware and resources, such as storage, CPU, and memory. The OS sits or works as a bridge between apps and hardware and connects all your physical resources that do the work and your software.
How can you run Android games or apps on a Linux machine without an emulator? Because of the creativity and inventiveness of some dedicated Dev Ops, there are currently several ways to run Android apps on Linux. This post will focus on how we can do that without an emulator. Let’s get started.
How to run Android applications in Linux without an emulator
Way before Microsoft could bring native android support to Windows 11, Linux spoiled the party. Linux is built with a compatibility layer that enables users to run android apps on any Linux distro called WayDroid. The layer offers an enhanced performance than an optimized android emulator. Using it creates the impression like Android apps are natively running on the Linux machine. Enough of talk; let’s now put this into action.
Run apps in Linux without an emulator
Step 2: Screen redirection
This should redirect you to such a screen:
Click on install on the Waydroid page
Step 3: Click install
Then click on install, as highlighted above. This should automatically scroll down to such a page:
You should locate a blue highlighted “docs ” link on the abovementioned page.
Step 4: Open in a new tab
Right-click on it and select the “open link in a new tab” as shown below:
Open the link in a new tab
Then scroll down to your PC’s distro type; in our case, we will scroll to Ubuntu/Debian and derivatives:
Scroll to your preferred Distro
Step 5: Install prerequisites
Here, you must first install the Client URL, well known as (CURL). This command-line utility enables the transfer of data over several network protocols. It communicates with a web or app server by specifying a relevant URL and the data intended to be received or sent. Libcurl, a portable client-side URL transfer library, powers curl.
To do this, open up your terminal by hitting the “Ctrl+Alt+T” keyboard shortcut combinations. After that, run the following command:
sudo apt install curl ca-certificates -y
Note: When asked if you want to proceed with the software installation, type “Y/y” and then press “Enter” on your keyboard. Alternatively, you can just hit the “Enter” button on your keyboard, and the installation should be underway.
Step 6: Export the distro command
Next, issue the following command based on your Linux distro. If you are using the latest Debian, select “bullseye,” and for Ubuntu users, use jammy for the Distro. In case you get a “Permission denied” error on the way, just run the “sudo su” command and then proceed with the commands:
Step 7: Download WayDroid’s GPG key
After you are done with that, run the following-given command to help in downloading WayDroid’s GPG key on your Linux distro.
sudo curl --proto '=https' --tlsv1.2 -Sf https://repo.waydro.id/waydroid.gpg --output /usr/share/keyrings/waydroid.gpg echo "deb [signed-by=/usr/share/keyrings/waydroid.gpg] https://repo.waydro.id/ $DISTRO main" | sudo tee /etc/apt/sources.list.d/waydroid.list sudo apt update
Step 8: Upgrade the system cache repo
After that, you can run the following command in case there are packages in your system that need to be upgraded:
Step 9: Install WayDroid
In the end, you should be set to set up WayDroid on your Linux machine. To do this, run the command and press “Y/y”, and hit the “Enter” button whenever prompted to proceed:
sudo apt install waydroid -y
And that should install WayDroid on our Linux system. Let us now focus on how we can start our WayDroid.
How to start WayDroid
Step 10: Start WayDroid services
Now that we are almost done. We need to fire up some WayDroid services before executing Android applications on our Linux PC without an emulator. Interestingly, there are a couple of ways to get this done. As per WayDroid’s official website, you can manually start the service by issuing the following command:
sudo waydroid container start
Manually start the service
At the tail end, run the following command, and WayDroid’s Graphical User Interface will open up on your Linux computer. You can now enjoy the Android applications on your Linux PC. By the way, you can also start WayDroid from the app drawer:
And WayDroid should comfortably run.
Alternatively, you can go to WayDroid’s home page and copy the highlighted command to your terminal:
Or copy and paste the following command in your terminal as displayed here:
sudo systemctl enable --now waydroid-container
Then click the “Activities” button on your desktop and search for WayDroid as shown below:
Clicking on the WayDroid icon should pop up the following window:
On the Android type, you can either select VANILLA or GAPPS. We suggest you choose GAPPS as it allows you to install Android apps later when using WayDroid.
Then click on “Download” as shown below:
This will take some time, depending on your Internet speed. Then click on the green highlighted button”Done”:
Then go and start the application by clicking on the “Activities” menu and selecting “Waydroid” as shown below:
And you should have your Android system up and running on your Linux software:
Android system up and running
Proceed and install Android apps on Linux and enjoy the near-native experience.
Let’s poke at this other approach to do what we have just looked at. Here we will be using Anbox.
How to run Android apps using Anbox
Anbox is software that puts the Android OS into a container, abstracts hardware access, and merges core system services into a GNU/Linux system. Each Android app will be integrated with your OS like any other native application. Anbox app is built on top of LXCv(Linux Containers) tech to segregate the system from the host; the system is from time to time updated with the current version of the Android open source project.
Now, let us see Anbox’s features.
- It is secure – Anbox places its Android apps into a tightly sealed box without direct access to hardware on your data.
Emulators vs. Anbox
A significant difference between Anbox and other emulators, for instance, Genymotion, is that while others need to run on an emulator that generates its system, with its virtual hardware, kernel, and more, Anbox, on the other hand, runs an android system using the same hardware, kernel and more to host without any emulation layer, permitting better integration with the host OS.
Installation of Android apps
While play store installation is generally possible, Anbox does not ship with what is installed since Google does not permit anyone to ship their apps on an uncertified device. The vendor did not sign an agreement with them. As such, you may be asking, why should I set up software that supports other applications but can’t install them? You can solve your problem if you have an Android Debug Bridge (ADB) set up on your system, and then you just need to do: $ adb install path/to/my-app.apk, And your software should be integrated with the host system. An ADB is a tool used to debug Android-based devices.
Let us now see how we can install Anbox on our Linux system.
How to install Anbox on a Linux system
Anbox is only distributed as a .snap app. DevOps selected this option because of its straightforward nature to distribute the software to users, regular and delta updates, easy and fast packaging, and other options. There is no plan to create a Flatpak by the Anbox team, but they accept contributors who would love to port it to Flatpak. Because Anbox is still not in the stable distribution list, it does not use proper confinement for snaps. As such, it is only possible to set up on dev mode, which is not a much secure mode to install as it disables confinement of apps installed, but this should be resolved in the coming days or months.
Here are the steps to follow up to set it on your system using snaps.
Issue the following command to install it:
sudo snap install --devmode --beta anbox
Or fetch the script using the following command:
wget https://raw.githubusercontent.com/anbox/anbox-installer/master/installer.sh -O anbox-installer
Just click on “Activities,” then search for “Anbox,” and click on the icon to open it
Final Thoughts
And that is how you cleanly set up and run Android apps on your Linux PC. The Linux version of the Distro you are using does not matter whether it is Debian, Ubuntu, or another distro. As mentioned earlier, the performance of Android apps is exceptional.
The above approaches have shown us that even if you don’t own an Android device, you can still run some apps or games, for instance, Gmail, Whatsapp, and many more. We hope this guide came in handy for you guys! And that is all from us. In case of any questions, please let us know in the comment section below.