Well, first things first. Before actually developing an app you need to make sure you meet all the system requirements for developing an Android application , unless you want to be stuck in between. If you are not sure of what are the system requirements you can quickly read this.
I assume now you have Android Studio installed on your machine. So lets start
Getting Started- Hello World Android App
Now that you have everything to start with just go and click on the Android Studio icon and open it. This will open a dialog on your screen. On the dialog just click on the “Start a new Android Studio project” (look at the screenshot for reference)
This will take you to a new dialog which will already have some pre selected fields.You can change them if you want
Here is the quick info of what these fields mean
- Application Name – This is the name of the application you are building
- Company Domain – This is the name of your company domain . It will be part of your package name.
- Package Name – This is the name of your package where all of your project files reside. It is expected to be unique
This will take you to a new dialog where you need to specify the target devices for which you are building this application.
Over here you need to specify the minimum SDK versions you are targeting. Minimum SDK version means the minimum version of the Android Operating System required to run your application. It will actually decide what APIs will be available to you while developing the app (Keep it unchanged unless you have any special requirements). Most of the fields are pre-selected and if this is your first app I recommend you not to change any of these to avoid unnecessary confusions. Now click “Next” which takes you to a new dialog(look at screenshot below)
Well, you are almost there. You now need to select the launcher activity of this app.( Not sure of what an Activity is? Read this ). So, basically you are selecting what a user will first see on the screen when he launches this application
Android Studio is really helpful when it comes it these things. It provides you with a bunch of activities to choose from. This contains everything from complex activities like “Map Activity” to simple activities like Empty or Basic Activity. Just selecting one of them will automatically add all the UI and Java code to your project.
For this case, select the “Basic Activity” and click “Next”
Calm down this is your last dialog, and this just has two fields. Basically you just need to specify the file names for your launcher activity and layout file. As I explained here Activity is actually a UI component bundled with some functionality. Android separates the UI and functional part into two separate files to honour the Model-View-Controller programming design. UI design is part of XML file. XML files are easy to design and read plus have a tree like structure making it appropriate for Android UI development. Whereas for the implementing the functionality we have a separate java file which binds to the UI and performs the required actions
Give the appropriate file names and click “Finish”.
That’s it!. This will create a completely functional Hello World Android App.
Congrats everyone! We have just created a fully functional Android Application. But you might still be confused seeing all the files/folders in your upper left window(Highlighted in the above screenshot). Well, these are all the files Android Studio created for you to get this application working. Each one of them has its own functionality. Here is a quick intro of all of them
This contains the .java source files for your project. By default, it includes a MainActivity.java source file having an activity class that runs when your app is launched using the app icon.
This contains the .R file, a compiler-generated file that references all the resources found in your project. You should not modify this file.
This folder contains the Android package files .apk built by the ADT during the build process and everything else needed to run an Android application.
This is a directory for drawable objects that are designed for high-density screens.
This is a directory for files that define your app’s user interface.
This is a directory for other various XML files that contain a collection of resources, such as strings and colours definitions.
This is the manifest file which describes the fundamental characteristics of the app and defines each of its components.
This contains gradle files which are used while building your android application. They contain information like version name/number, third-party dependencies and repositories
Congrats guys you have learnt how to develop a Hello World Android App and also know what are its various components. I regularly write tutorials on Android Development for beginners which you can check out here. In case of any confusion or doubt feel free to comment, I usually reply within 24 hours.