There are more than 2.8 million Android apps in the Google Play Store. And the app development market was worth $58.7 billion in 2018. These numbers are astounding and are still on an upward trajectory. Hundreds of apps are being developed and added into the Play Store every day.
More and more people are learning how to develop mobile apps and taking it up as a career. In this article, we take a look at how you can develop your first Android app.
What language is used for Android app development?
You need to have a good knowledge of Java for Android app development. It is the official language of Android Studio, which is the native integrated development environment (IDE) for Android applications.
How to use Android Studio for app development?
Android studio is a comprehensive IDE, consisting of the SDK (tools for programming), and a Virtual Device where you can preview your program. It has an intelligent Code Editor with the IntelliJ IDEA interface, which auto completes your codes. With the Virtual Devices’ support, you can test the performance of your application under a wide range of device models. The IDE also has a feature known as Instant Run, which allows you to see how your program runs in real-time on various devices as you make changes to your code
Besides Java, Android Studio also supports C++ and Kotlin.
Android Studio is a complete package letting you build anything, from simple Hello World apps to the most interesting role-playing games (RPG).
Here is how you can set up and install Android Studio on your computer and start creating your very first app.
Download and install Java
First, your PC should be able to run Java. You need to download and install the Java JDK.
Step 1: Go to Java’s the official link. Download the file and follow the instructions to install it.
Step 2: Launch Control Panel. Go to System and Security > System >Advanced System Settings.
Step 4: Click on Path and Edit. Add the path where you have installed Java followed by a \bin. Usually, it is C:\Program Files\Java\ (JDK version you installed)\bin
Save the settings and exit.
Download and set up Android Studio
Android Studio is free for download on its official website. After downloading the exe file, install the program, and launch it on your PC by following the on-screen instructions. Make sure you also install the virtual device by checking the box.
As you run Android Studio for the first time, it will also download the required SDK tools.
Start a new project
Launch Android Studio. You will see an option to start a New Android Studio project. Click on it to open the IDE for the first time.
The next step is choosing a theme for your application. You will be given a list of Devices and Activities. An activity is the screen of an app that lets users perform specific actions. In other words, it is where you will create the user interface (UI) for your user.
Android Studio has pre-created activity templates, for example, for Google Maps and log in, which you can customize to how you want them to look like. Select one and click on Next.
Give your project a name
Enter your app name and company domain, which, in most cases, is the website of your firm. On the same screen, you can also choose the programming language you want to use for the activity. If you want to select C++, go back to the previous step and you will see C++ native as an activity itself.
Finally, click on Finish, and you can start your work.
Understanding the components
We named our app New App, and as you start Android Studio, you will see the following screen.
To change the layout of the screen, you will need to modify the XML code. To access it, click on the activity_main.xml tab next to Mainactivity.java.
The screen saying “Hello World” is the current screen of the app page you are editing.
Building a program in Android Studio
Now, the next step for you to do is learn Java. We are not going to do that in this article, but we are going to modify the above XML file a little and change the text to create the most basic program. Then, we will build it so that it can run on a device.
Here are steps for changing the “Hello World” text to something else.
Step 1: On the activity.main, right-click, and then select Go to > Declaration or Usages.
Step 2: As you do that, you will go back to the XML editor.
Running your program in Android Studio
Step 1: Go to the Build menu on the top. Click on Make Project. You can also press Ctrl+F9.
It will turn to Gradle Build Finished after some time. This means the build is complete.
To install the app, you should first enable Developer’s Options on your phone. For this, you can go to your phone’s Settings > About and tap on the Build Number a couple of times. If it doesn’t work, you can Google search your phone model and see how to do it. Then, launch Settings again, and scroll down until you see Developer’s Options. Tap on it, and turn USB debugging on.
Next, install the ADB driver on your PC. Connect your phone to your PC via USB, and you will be shown a prompt on whether you want to enable USB debugging. Tap on “always trust this computer”.
Launch Android Studio and you will see the name of your device on the tab that lists virtual devices. Select your phone and launch the program, and the app will be installed (and launched) on your phone.
You will see two options, one is Building an App Bundle to upload on Play Store, and another is the APK. APK is an installer; if you want to test your app on your phone, select APK.
You will need to generate a key store path, i.e. the location on your computer where the key store will be kept.