Do you know about the abundant opportunities waiting for an Android developer?
Or, have you got any idea that can be transformed into a mind-blowing Android Application?
Are you a Java programmer curious to become an Android developer?
If yes, this article will surely be going to help you.
How to become an Android developer?
If you are someone who has the basic knowledge of coding, you would already know that coding involves a set of procedures. Similarly, there are a few standard steps you should be followed if you want to start coding for Android.
Build your first Android App
Step 1: Download Android Studio
You can download the Android Studio from google or simply clicking here.
Android Studio is the most common IDE for Android development, developed by Google.
But what is IDE?
To program in most languages, you need a piece of software called an IDE or ‘Integrated Development Environment’. IDE is where you enter your code, debug, compile and run. It saves you time and effort.
Android Studio is specifically designed for Android development (unlike Eclipse). You need to include the Android SDK (a selection of tools including the Android platform itself) and the Android Virtual Device, which is an emulator you can test your apps on. During the installation process make sure to tick all boxes to confirm that you want these additional components. It is possible to add them manually later, but that will make the process more complicated.
There are many other alternatives available for Android Studio. Eclipse is an older IDE that can be used for developing apps also for other platforms like iOS. Basic4Android is also an available option.
Step 2: Setting Up Android Studio
Now you have installed Android Studio. But before you get started, you need to install Java on your machine; specifically, the Java Development Kit (JDK).
Java is the programming language you’re going to use for building your Android apps and you need to install the JDK to interpret and compile your code.
You can find the Java Development Kit here. Just download and follow the instructions to install.
Now click and launch Android Studio, there will be a menu where you’ll be able to get started or to configure some options. Everything is there already available for you at this point.
Now that you may want to familiarize yourself with the SDK Manager (Configure > SDK Manager) which is where you’ll update your Android SDK to support newer versions.
Step 3: Starting a New Project
After you have installed Android Studio, click on “Start a new Android Studio Project”. Enter the name of your application and your ‘company domain’. These elements combined will be used as your package name (eg: com.companydomain.appname).
The last area to set is the place where you want your project to be saved.
Click on Next to go to your next page of set up. Here you can find more options where you can set the type of device which you are going to develop. As a start choose phone and tablet option. There are other options like TV, Wear and Glass which you can refer later.
The next choice you want to make is the ‘Minimum SDK’ which is the lowest version of Android you want to support. Leave this option with default.
Next Page provides you with the option to pick how your app wants to look at the start. This will be the main page of your application which in other words called as the ‘Activity Module’. This screen will provide you with many templates for creating your first page of the app.
Now let’s start coding…
You are expecting a “HELLO WORLD”, right?
But unfortunately, Android Studio has already done it for you.
Ok, I think you have noticed that there are two files. MainActivity.java and activity_main.xml
While creating a new project android studio creates a default java class(You can delete it and create a Kotlin class with extension .kt . Kotlin is included as an alternative to java). The program logic and UI updation (Data Binding will update UI when value changes. Don’t look at this now, it will make things complicated. It can be studied later) are done.
So how we design the User Interface?
We have an XML file (activity_main.xml) where we design the UI. Down the left, you can also find an option called ‘widgets’ that you can add to your app. This makes the process of designing UI a simple task. You can drag and drop widgets and views.
Now you can start making your app. You will get a million samples on google. Before that please go through the project structure.
This folder containsAndroidManifest.xml. This file describes all the components of your Android app like the activities, services, broadcast receivers, and content providers that the application is composed of.
All your Java language files are organized here. The java folder contains three subfolders:
com.example.android.firstapp (or the domain name you have specified): This folder contains the Java source code files for your app.
All the resources of your app like images, layout files, strings, icons, and styling are present in this folder. It includes these subfolders:
- drawable: This folder is used to store all your app’s images.
- layout: The layout files for your activities are contained in this folder. In the beginning, our app has only one activity that has a layout called “activity_main.xml”.
- mipmap: It is the folder which contains applications launcher icons.
- values: All the strings and colours used in the app are contained in this folder.
This is a ‘build automation tool’ which mainly helps Android Studio to turn all those different files into one single APK. You are free to leave Gradle to do its thing by its own most of the time. However, you may need to jump into the build.gradle files at times, when you want to allow additional features for your app, add a new ‘dependency’ at build.gradle file. Sometimes, if things stop working, you can choose Build > Clean Project and this will essentially guarantee where all the files are and what their roles are. Generally, there will be two of these Gradle build files, one for the whole project and one for the ‘module’ (the app).
Run Android App
Now it’s time toRun Your App. You can run your app in an emulator or an Android device.
Step 4: Things to remember
Here are some practices we need to keep in mind.
Always try on new things. Don’t try to make a world-changing app in the beginning. Instead, think of something simple and straightforward, and then build on that. Try changing the layout of the text or try adding in more buttons and more rules to make your app useful.
It’s time to look a bit at the code and write something. Practising along with learning the theory is the best way to learn coding.
Official Android website provides us with options to code while learning. For this, go to official Android Website and navigate to Develop.
There are two most important sections:
- Training – you can find there a lot of helpful examples. Before you try out some real programming, go through all these lessons.
- API Guides – I know it will be hard to go through all these texts, descriptions, and examples. But, trust me, doing so really worth it. And, it is very important.
You are very lucky to have an assistant like Google with you. It offers you solutions for any problems you are having. But Ask correctly! You’ll find a list of complicated answers but eventually, probably on Stack Overflow, you will get the right answer.
What you should do next is, you copy that code and paste it into your app, making changes that are necessary as you go.
Likewise, take Android Studio and try out some of the code samples available. Just see how they work and experiment by changing each component. Things will go wrong and error messages will pop up frequently in the beginning. But for the most part, if you just follow the instructions, it’s easier to handle such error.
And, that’s pretty much how you learn to make apps. Once you have the main program in place, the rest you can pick up as you go.
Step 5: How to Get Better
Now you may have a doubt. Here I am sharing a few links that will help you in your journey to becoming a better Android developer.
- Android Weekly – Every week lot of interesting Android contents and articles are published here. Don’t miss it, Subscribe it!
- AndroidDev Digest – Subscribe to get a lot of interesting articles and more.
- Fragmented Podcast – Talks about becoming a better Android developer with a lot of very interesting people from the world of Android.
- Android Developers Backstage podcast – If you are an Android developer, this is going to be one of the most interesting shows for you. This show features in-depth discussions and interviews with engineers on the Android team at Google. This show is hosted by developers from the Android Engineering team.
- Android thread on Reddit – It covers news, codes, information and observations more directly from Android developers all over the world.
- Android Developers blog – It is a blog that covers some interesting texts written by Android Engineers from Google.
- Subscribe official Android Developer’s Youtube Channel – This channel is also created and maintained by Android Developers at Google.
Reading theories, learning new things and practising regularly will make you a good Android programmer, maybe the best one in the industry. So, don’t give up, errors will come, search for a solution, find it, and solve the errors with the help of the solution you have found.