DEV Community

Cover image for How to install Vscode on android
Josias Aurel
Josias Aurel

Posted on • Updated on

How to install Vscode on android

Hello there. Today (about an hour ago) I tried something cool. As the title says it. I will show you how to install visual studio code (code Oss) on android. Yes, you got it right.

I will assume you know how to use a terminal. In this tutorial, we will use the most popular android terminal called termux. You can get it here.

Code Oss

I will not waste your time. It's a fork of visual studio code intended for arm based computers like Chromebooks. You can check on their official site

How to install

Here i assume you've installed termux

Steps :

Install Ubuntu in your Android device. It's targeted for such systems. Copy paste the following and wait for it to finish installing

pkg install wget openssl-tool proot -y && hash -r && wget https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Scripts/Installer/Ubuntu/ubuntu.sh && bash ubuntu.sh
Enter fullscreen mode Exit fullscreen mode

Once done, run this command:

./start-ubuntu.sh
Enter fullscreen mode Exit fullscreen mode

When you are in the Ubuntu terminal, you can run the following to grab the editor.

wget https://github.com/cdr/code-server/releases/download/2.1698/code-server2.1698-vsc1.41.1-linux-arm64.tar.gz
Enter fullscreen mode Exit fullscreen mode

Extract it with the following.

tar -xvf ./code-server2.1698-vsc1.41.1-linux-arm64.tar.gz
Enter fullscreen mode Exit fullscreen mode

Voila, you have the editor extracted . Now you can optionally delete the archive to free up some space else your are going to use it later.

The files are no more in an executable format, they need to be placed in a /bin folder for you to have the ability to call it

Due to that, the following command should do the work :

cp ./code-server2.1698-vsc1.41.1-linux-arm64/code-server /bin
Enter fullscreen mode Exit fullscreen mode

Voilà. You can now call the editor by running "code-server" any where in your terminal and you will be able to use it. It is served on localhost:8080.

Final note: Each time you launch it, you'll see a new password and it can be annoying. So let's set a password in our environment variables.
Run this :

export PASSWORD="<your_password>"
Enter fullscreen mode Exit fullscreen mode

Replace with any password of your choice and each time you launch the editor. You'll use the exact same password.

Here is my original tweet :
Liquid error: internal

Like and share

Most credits : Ada Rose article : Coding on Samsung DeX

Buy Me A Coffee

Top comments (25)

Collapse
 
mrarmyant profile image
mrarmyant

Now for bonus points, how do I install node to that ubuntu instance, and map/mount the sd card :D

Collapse
 
sajid1500 profile image
Sajid1500 • Edited

Any idea how to install code server directly on termux home or make a link for my files to Ubuntu? All of my project folders, packages, modules are in termux home directory which can't seem to be accessed using code server.

Collapse
 
josiasaurel profile image
Josias Aurel

Personally I have never tried. You could do so :). I don't use the vscode that much tho

Thread Thread
 
sajid1500 profile image
Sajid1500

Which code editor are you then using?

Thread Thread
 
josiasaurel profile image
Josias Aurel

Vim/Emacs

Thread Thread
 
sajid1500 profile image
Sajid1500

Just to let you know, there is also an vs code clone on playstore named VHS code. If you want you could also make a article on that so others can benefit from it.

Thread Thread
 
seanmclem profile image
Seanmclem

Is there?

Thread Thread
 
sajid1500 profile image
Sajid1500

Here's the link. It has bugs though. play.google.com/store/apps/details.... If you want you code check out these two apps. Acode and spck code editor.

Thread Thread
 
seanmclem profile image
Seanmclem

VHS code seems to work fine. It's basically just a wrapper for termux running code-server. Which is great actually. There will be lots of input bugs on phones because Monaco doesn't really support touch screens and phone keyboards for some reason. But physical keyboards or Samsung Dex should work well

Thread Thread
 
sajid1500 profile image
Sajid1500 • Edited

Install codeboard or hacker's keyboard. You should not have any typing issues after that.

Thread Thread
 
seanmclem profile image
Seanmclem

Well, I might have tiny-screen issues on my phone. I'm just excited to have the option to dev for real on Android. It will go well with windowing, laptops, tablets etc

Thread Thread
 
sajid1500 profile image
Sajid1500

yeap. Dev for real? Well, I use it an alternative till I get a new pc. It still lacks a lot of things.

Thread Thread
 
seanmclem profile image
Seanmclem • Edited

Well primarily I use Windows, Linux, Mac OS, and even chrome os, but this is a nice step towards making Android a viable platform to develop on

Thread Thread
 
sajid1500 profile image
Sajid1500

True

Collapse
 
mrarmyant profile image
mrarmyant

I ended up installing code-server in a cloud provider I had and installed the site as a pwa on the phone. Having the full linux bash in the terminal is nice and it requires less work compiling weird projects. The next step would be to create a vpn so the phone could share a connection to another network (or if it was run on a laptop) to access things on a local network (I'm an IoT dev)

Collapse
 
calag4n profile image
calag4n • Edited

Those crazy things we can acheive nowadays ! 😅

Collapse
 
josiasaurel profile image
Josias Aurel

Yeah it's cool

Collapse
 
erikmuir profile image
Erik Muir

I'd love to see an update to this article using the newest version of code-server.

Collapse
 
sausagetaste profile image
Sungmin Woo

This is beautiful! Now my Galaxy Tap is a full-fledged dev machine. I'd never imagined I could do genuine C++ development on Android.

Collapse
 
josiasaurel profile image
Josias Aurel

That's exciting. I can now write C/C++ and even Rust on my phone 🤪

Collapse
 
gokunik profile image
GokuNik

This was helpful but how can i run cpp on it?

Collapse
 
josiasaurel profile image
Josias Aurel

Hi, as visual studio code is running inside termux, you can technically run any command from vscode terminal and it will get executed in termux. Just make sure you have clang or gcc installed.

Collapse
 
rodrigozan profile image
rodrigozan

Uou... Thanks for this! o/

Collapse
 
satrujit11 profile image
satrujit11

My python extensions are not installing ... it's shows an error telling that ...this extension is not compatible for this version..how do I install the latest version of it

Collapse
 
josiasaurel profile image
Josias Aurel

I think that could be expected as the extension builds are designed to run on some specific platforms. It is possible to modify the extension to run on aarchthough