How to backup Android apps source code from Android Studio or command line

Developers use Android Studio to create applications for Android devices. However, if a source code management system like github is not used, then the source code or code of these apps under development has to be backed up. To do this, there are two ways, one from Android Studio and the other from the command line.

From Android Studio
From the main menu. select File -> Export -> Export to Zip file... to export the project currently open to a zip file.

From Command Line
Open a terminal window and enter the following commands:
$ cd ~/AndroidStudioProjects/MyProjectName <enter>
$ rm -rf .gradle .idea build app/build <enter>
where MyProjectName is the Android Studio project folder to be backed up.

Exercise caution when using the command line and to be safer, it is always better to backup from Android Studio.

Just backup of a single project in the AndroidStudioProjects just crosses over 100 mb if the entire folder is backed up using tar or zip.