This content provides a comprehensive, step-by-step guide on how to run Android applications on a Linux desktop environment, specifically focusing on setups using the Xorg display server, by leveraging the Waydroid containerization tool.
Mind Map
Click to expand
Click to explore the full interactive mind map • Zoom, pan, and navigate
Hey guys! Hope you're having a great day! Today, I want to show you how to run Android apps on
Linux that use Xorg display server. This can be adapted for systems using Wayland,
as it's the same thing with fewer steps, but I'll cover all the extra steps needed to get
it running on Xorg. As you can see, I've got an Android running right here on my desktop.
It looks like a phone and works like one! You can pull down to access the app menu,
just like on a real Android phone. And of course, you can run the apps.
We have AntennaPod podcast app running smoothly on our little android here. All options are
available and everything works like a charm, you can add podcasts and listen to them. Next,
we have Instagram installed and it runs without any glitches, but I am not logged in to show
you the full features. Finally, we have TikTok installed and working normally, but I blurred
the screen because I didn't want to include random TikToks in my video. However, you can trust me and
see through the blur that it works great. We have full Android here, so we can also use features
like force-stopping apps, using the file manager, and installing any other Android app we want.
Alright, now that you know what it is, let me walk you through how to do it and set everything up!
It's super simple, and we'll go step-by-step." Alright, we're going to do this using Waydroid.
It's a Linux program that functions like a container with a full Android system. Imagine
it as a docker with a full-blown Android inside. If you're not familiar with docker or containers,
don't fret; it's not too complicated to set up. To begin, let's head over to the Waydroid
website. I'll provide a link in the description below. As you can see, it's a pretty big project
with plenty of information on their website. It's free, open-source, has app integration,
near-native performance, and lots of other cool features. This little program is truly amazing!
Okay, let's start with the setup process for Waydroid. First, we need to add the Waydroid
repository to our system and then install Waydroid itself. To do this, we click on 'Install' and then
click on 'Docks' to get to the doc explaining the setup process. Scroll down until you find
the distro you are using. I am using Linux Mint, which is based on Ubuntu, so I will follow the
Ubuntu instructions. I'll zoom in a bit so you can see better. Now let's look for the Ubuntu
instructions. Here it is, found it. So let's open our terminal now. I'm changing the fonts so you
can read better. Okay, done. The first step is to copy the install prerequisite line, just as I did
here. I won't copy "-y" because it automatically clicks "yes" but I like to read what it will
do to my system before it does it, so I always type in "yes" or "y" manually. We're using apt,
so we need a sudo password. I forgot to refresh my apt archive with 'apt update', so I recommend you
do it too. Okay, let's try 'apt install' again, just in case. Now let's use the 'cd' command to
change the directory to 'downloads' because we need to download some files. You can use any
folder for this, just remember what you're using. If you're not sure, just use 'downloads' as I do.
I'm just using 'ls' to check if there's anything there; it's empty. The next step is to use their
script to add the Waydroid repos. They recommend piping their script straight into bash with sudo
permissions. In this case, it's safe, but I never do this before I read the script. So instead of
what they're doing, I'll first download the script with 'curl', and then read it and check it out,
and after that, I'll install and run it. I forgot we just installed curl, muscle memory. And now I
forgot to add 'output' to 'curl'. Now 'curl' is outputting to 'install.sh', which is the
correct command. Okay, it's downloaded. Now we can check the script out with the 'cat' command.
I already read through this script and found it safe, but always do this yourself before
you run any script with sudo. So now let's use 'bash' to run it. After I resize my terminal,
of course. Okay, here we go. And now we let the script do its magic! And it's done, the Waydroid
repo is added to our system. And now we need to use 'apt install' to install Waydroid itself.
It will pull the latest version of Waydroid from our newly added repo. Add 'Y' because
we want to install it. And it's done, Waydroid is installed, but we still need to set it up!
So next thing we need to do is let Waydroid download the Android system image. Right now,
we have everything we need to run Android, but we don't have the Android system itself. So let's
download it. Make sure it's a vanilla image; we want a pure Android version for this. Just click
"Download" to start the download process.Now, we need to wait for the download to finish. This can
take some time, as it can be up to a few gigabytes in size. Be patient here, as it may take a bit.
When the little terminal log window shows "Done" and the green "Done" button becomes available,
it's done. So now we have the Android image. If we are using Waydroid on a Virtual Machine or
with an NVIDIA GPU and it doesn't work, we need to change a few settings. This is explained here:
"Get Waydroid to work through a VM." It says "VM," but it also helps with NVIDIA GPUs. So
let's go to that link. If you don't have an NVIDIA GPU or you are not using a VM,
you can skip this step. But for the rest of us, the first step is to open this file in a text
editor. They are using "nano," but you can use any text editor you like. I prefer "xed," so I
will use that. We need to use "sudo" since it's a system file. Now, we need to add these two lines
right under the "properties" tag. Just copy and paste them, as I did here. Now, we need to run
this command to make the changes take effect. Just copy and paste it, run it, and you're done!
Okay, since we're on X11 here, and Waydroid is meant to be used in Wayland,
we need to install a Wayland compositor that we can open in a window where we can run Waydroid.
If this sounds a bit complicated, don't worry; it is. But the simple version is that we need
a program to run Waydroid inside. It's easy to install with apt, so let's do that. The program
we need is called Weston, so let's install it using "apt install weston." Let it install,
and when prompted, type "y" to continue. And it's done! Now, we have our Wayland window
inside X11. If you happen to be on a distro that uses Wayland, you don't need this step.
So let's check if everything works for now. First, let's open the Weston window. Here it
is. Now let's open Waydroid inside it. Just click on the small terminal icon in the upper
corner to open a new terminal inside Weston. And now we need to run Waydroid from a terminal
inside Weston. And it's starting up, Android is turning on. Let's give it a second. And it works;
we have Android! However, if we leave it like this, we'll have a few annoying bugs,
and it's not in a phone-shaped format, and many apps expect that.
First, let's check our Android version, which will be important later. Right now,
I'm running Android 11, but that can be different for you. The first big problem we'll encounter is
that we don't have an internet connection. That's because the firewall is blocking it.
If it works for you, there's a good chance that you don't have your firewall set up correctly,
and you should really fix that. But as you can see, we have no internet connection.
The next problem we have is that this can only run x86-64 apps, not ARM . This means
we can't run most Android apps that are meant for the phone, but don't worry;
I'll show you how to fix this in a moment. And we'll also create a simple script to use
Android without all these commands, so it's just a one-click process. Every time after we close
down Waydroid, it keeps running in the background and consumes resources. So every time we close it,
we need to stop it from running with the "waydroid session stop" command. You'll see me using this
command many times. And always use it after you close down Waydroid. Ok, it stopped now.
So what we need to do now is change our firewall rules and open up some ports to
get online connectivity in Waydroid. This changes your security settings,
so be aware of what you're doing. If you want to increase your security,
you can close down these ports after you're done using Waydroid. We need three commands to change
our firewall rules. Don't worry, I'll provide the commands in the link in the description below. OK,
that's it; we've changed our firewall rules. Let's see if it worked. We'll start it the same
way as last time. And let's see if the internet now works. And we are online. As you can see,
it works great.However, there is one problem I forgot to mention earlier.
When we open a new window, it will open inside the Weston. Some windows, like Firefox here,
will open as they should. But most windows won't. And we also need to fix this. We want to be able
to use our computer normally while using Android apps. Only Android should be open inside Weston.
To fix this, we need to set up some environment variables and change some Weston settings. First,
we need to export WAYLAND_DISPLAY and set it to something, like "mysocket" in this case. Then we
need to add some parameters to our Weston. The first parameter is the socket we just exported,
like "mysocket" if you used a different name, use that here. The second parameter is "x11" because
we are using an X11 backend; if you don't add this, it might try to use the Wayland
backend and not start up. All the commands are in the link in the description below,
so you can just copy and paste them. Let's try it out. Again, we need to start our Android.
Give it a minute. OK, it's on. And now folders open as they should, not inside Weston. Only
the Android is open inside Weston, as it should be. We need to stop Waydroid again.
So the next thing we need to do is make our Android phone-shaped. To do this,
we need to set the resolution and size of the Weston window. We do that by adding width and
height parameters. I am using values of 486 for width and 1000 for height because that's
the aspect ratio that many phones use and it fits on a 1080p screen. The size is in
pixels. You can use any values you want, and Android will try to fit it the best it can.
Let's start it and see how it works now. OK, the Weston window is now phone-shaped. Now let's start
Waydroid inside it. The same thing as always. Let it start. And it works! Now it looks like a phone,
great. We have internet, our Android is in a phone-shaped window, and only program running
in Weston is Waydroid. Great! Again, we need to stop Waydroid from running in the background.
Now we need to make it able to run ARM apps. To do that, we need an open-source program called
Waydroid Script. It's a project recognized by Waydroid, so don't worry. I'll provide the link
to it in the description. Waydroid Script requires a bit of setup to run and might seem a bit
complicated, but it's not that hard. I'll explain everything you need to know.To run Waydroid
Script, we need to use commands inside this little window. However, before we can use them, we need
to install a few things. First, we need to install Git. OK, Git is installed. Next, we need to
install Python Venv. Oops, I made a mistake. OK, now we're ready. I won't put the next few commands
in the description because they can change and it's best if you get them from the Waydroid Script
page. So first, make sure you're in a Downloads folder or a folder where you want to download
all this. Then, we need to clone this repo in that folder. Just use this command (it sounds
way harder than it is). OK, it's downloaded. Let's `cd` into our new Waydroid Script folder
and initialize our Python Venv. It's just an isolated Python environment, so it won't mess up
your system's Python. This step is very important, you must do this in a virtual environment. Next,
let's install Waydroid Script requirements. Just copy and paste the command. And now,
let's finally start Waydroid Script with the last command. OK, it's started. The first thing
we need to do is select the Android version we're using. That's why we checked that before. Here,
we choose "install." Next, we need to select what we want to install. We can't select with the
click; we need to use the spacebar as it says up there. Gapps are full Google services. MicroG is
a minimal Google services package that should make most apps work. Libdnf is an ARM translation layer
that works best on AMD CPUs. Magisk is used for superuser access on rooted phones. Smartdock is an
alternative dock for Android. Libhudini is an ARM translation layer for Intel CPUs. And Widevine is
a DRM protection used by services like Netflix. So we'll install MicroG because it's enough for
most apps, and I'll install Libhudini because I have an Intel CPU. If you have an AMD CPU, use
Libdnf. This will allow us to run ARM apps on our computer. Once we select, let's press Enter. Here,
we need to pick "standard." And it will download and install everything we need. OK, it's done.
Now let's run our Android again now that it's complete. Great, our Android works,
and we have a few new apps installed. One of them is the F-Droid app store, which is an app
store for open-source Android apps. We need to do some basic setup to make it work. Just accept
TOS and allow permissions. It's the same as on any Android phone. Oops, it crashed, but it works now,
and it just needs a moment to refresh the list of apps. Here, we have a bunch of open-source
apps we can just install. It has a live search here, so it refreshes as I type. I love the
AntennaPod podcast app, so I will download and install it. We need to give it permissions here,
just like any Android app, and click install again. OK, it's taking a bit, and done. Next,
I want to install the Aurora Store. It's an open-source app store that can download
all official Android apps. It's the same install process as before. Let's try out AntennaPod. OK,
it started up. Let's change the theme to the dark one. Yes, it works. We can also add
podcasts. Yes, it all works. Now let's try Aurora Store. It also needs some setup and permissions,
just like any app store on Android. Just grant it what it asks for. But for some reason,
sometimes it just crashes, like now, and I can't make it work, but sometimes it works great.
So, in case you encounter the same issue I'm facing now, I'll show you how to sideload APK
files to Waydroid. For this, I extracted Instagram and TikTok APK files from my
phone. You can do the same or get them online; there are multiple ways to obtain APK files,
just don't abuse it. Let's `cd` into Downloads where my APK files are. If you're not familiar,
APK files are installation files for Android apps, and you install APK files to get the
app. To install an APK file on Waydroid, we need this command. OK, it seems you can't
install multiple files at once. Let's do it one by one. Great, let's see if they are installed. OK,
Instagram is here, let's wait for TikTok. OK, TikTok is also here. Both are installed. Let's
try them out. Instagram works but I won't log in. TikTok also works. It asks for age,
let's give it some random age. This can take a bit with the mouse but it works. Let's agree.
And let's pick funny things. It works great, but I'll blur it in the post because I have no idea
what videos will pop up or who made them. But you can trust me that it works great.
And now for the final step, let's create a script that runs everything for us,
so we don't have to type out all the commands every time we want to run an Android app. First,
we use the `touch` command to create an empty text file we can write to. We need to put it in
our path, you can use the same one I am using. We also need to use `sudo` because this will create
a system file. How do we name our script? Let's name it "startandroid," you can name it whatever
you want. The last word after the last slash will be its name. Next, we need to open this file in a
text editor with `sudo` permissions. I'll use `xed`, but you can use whatever you want. Now,
we need to write our script. I'll put the script up on my Git with the rest of the useful links,
so you can just copy and paste the text if you want. First, we need to export our environment
variable. Then, we need to start Weston with all parameters. And then, we need to start a Waydroid
inside it. We need to put `&` after every Weston and Waydroid line, or our script will get stuck,
so don't forget that, it's important. Then, save it. Now, let's give it the right permissions. We
can do that with `chmod 755`, don't forget to use `sudo` again. And then, we can use `chown
0 0` just in case. And now, let's try out our script. Our Android phone is starting
with just one command. It works, great. But we still need to stop Waydroid after closing it.
And that's how you can run Android apps on your Linux machine. Thank you for watching. I hope you
found the instructions clear and easy to follow. Until next time, have fun and happy thinkering!
Click on any text or timestamp to jump to that moment in the video
Share:
Most transcripts ready in under 5 seconds
One-Click Copy125+ LanguagesSearch ContentJump to Timestamps
Paste YouTube URL
Enter any YouTube video link to get the full transcript
Transcript Extraction Form
Most transcripts ready in under 5 seconds
Get Our Chrome Extension
Get transcripts instantly without leaving YouTube. Install our Chrome extension for one-click access to any video's transcript directly on the watch page.