2020-11-05 update VSCode has already support
aarch64, no more need
Since VSCode added the remote ssh, it can separate interface and backend, and only need ssh protocol to connect backend, Recently, I had the idea that I could create an ssh port on my Android phone, and then use VSCode to run a server on my phone, When you go out, you can write and read code by connecting to Android, after all, the performance of the smartphone is good enough.
My phone is a OnePlus 7 Pro official system, not rooted.
Termux is a lightweight, cross-platform, open source, cross-platform terminal emulator. I have introduced it in DevOps pains and the use of Termux, the termux could also start an OpenSSH server in the phone:
$ pkg install openssh-server
telnet to check the server.
After that, we need to create a ssh key-pair, or use the exist public key.
You could use
adb push to push the publish key to the phone, and then copy it to the authorized_keys.
Then, you may connect the phone throught the terminal:
~ ❤ ssh firstname.lastname@example.org -p 8022 -i ~/.ssh/id_rsa_raspberry
There is part of the ssh_config:
There is a problem
aarch64 is only supported in VS Code Insiders
So, I use VSCode Insiders https://code.visualstudio.com/insiders/.
There is another error that node can’t run:
I’m trying to use
node to run js code, but I still got errors.
This time I guessed that the Android runtime library was missing some files, and I didn’t give up, and turned to look for containers on Android.
I found a tool that can run containers in Android: https://github.com/nmilosev/anyfed.
proot, which means you don’t need root your Android phone.
You can notice it get a Fedora image.
- Setup the cpu arch
- Donwload the container
- Configure sudo and proot
- Try to start the container
$ unset LD_PRELOAD
There is no
ssh in the anyfed, so we need to install
[root@anyfed home]$ sshd
You need to create another
ssh_config, and this time we use root user:
~ ❤ ssh oneplus2
I clone a repo in GitHub, use VSCode open it.
A notict to install Python extensions
Compare to the old laptop, the smartphone performance is better.
VSCode actually give us a solution to use the idle resource in smartphone to develop. As the smartphone is more powerful, the performance is also better. I’m no doubt that one day the performance of the smartphone is good enough to allow us to develop on it. I’d like to combine VSCode and Frp as a solution to develop on Android smartphone.