Coding On Your Android Phone Using Termux

Writing code on Android Termux app

Software development is not a task that you can solve in one sitting, it can take you hours to build stuff, and requires a lot of debugging. But to do small things like develop a small feature in your free time when you're away from your laptop is a time hack. You can achieve that by using your phone alone. Here's how.

Install Termux
All developers or whatever IT guys need is a simple command line tool that you can use to do some operation like editing a file or installing some tool or program on the system. Luckily the Android world is very robust, we have a terminal tool to execute the Linux command line on your phone. The app is called Termux.

Although Termux is available on the Android Play Store, it's been long abandoned by the developer, it's still running but no longer maintained. The newest version of Termux is available on the F Droid app store. So the first thing to do is install f droid and install Termux from FDroid instead of the Google play store.

Actually, by Termux alone you can do any kind of coding using it, like on your computer you first need to install Vim for editing your code and install some more tech stacks you need. After Termux is installed and ready everything is just the same as if you are working on your regular computer.

Still, if you need to know how to develop a react app, here's an example step-by-step of developing a react application using Termux on your android phone.

Install NodeJs
No need to worry, Nodejs is also available on the Termux repository. You can use this command to install node js on your android phone. First, like always find an updated package:
pkg upgrade

Then install node js:
pkg install nodejs-lts

Verify the installation:
node -v

Also you need python because nodejs requires it
pkg install python

Allow Termux access to your external storage
If you want your project to be accessible by another app later, for example, file manager or Vs Code, then you need to make sure that Termux is allowed to access the storage. And later you create your project inside the external storage that you are familiar with. So that you can open the project using another app.

To allow Termux access to the system's external storage type :
termux-setup-storage

Now if you type: ls. It will show the list of folders on your phone. Navigate through the folder using the CD command.

Create your react project
Every Nodejs installation comes along with Npm or NodeJs package manager, so just like the usual type:
npm install -g create-react-app

That will do the same way as if we are on a computer running windows, Linux, or Mac.

The next step tries to create your new react app on a folder you choose by using the CD command. After the cursor is at your chosen directory, create react project using :
create-react-app your-app-name

Edit the code on vim, and change whatever is inside app.js to verify that you are doing some changes using vim on Termux.

To debug and run your react app as easily as usual:
npm start

Conclusion
And just FYI, I also wrote this article using only google docs on my phone while I feel bored lying on my bed because I am not in the mood to sit at the desk, even though my computer is just right there in my room.

Termux is a very helpful tool for us developers whenever we are not in front of a proper computer. When you need more editors, Vs code is also available on the google play store.

I have been working as a software developer for over 7 years. Me, I know a lot of things to do for setting up my working environment. Mainly I am using windows.

Now that I am not always bringing my laptop with me, my only tool to do software development is by using my phone which is never far away from me. A smartphone is always available near me, unlike my very heavy laptop.

Popular posts from this blog

ERROR 1348 Column Password Is Not Updatable When Updating MySQL Root Password

How To Create Spring Boot Project Using Netbeans

Spring Kafka - How to use ReplyingKafkaTemplate send and reply synchronously