Learn Android Studio – The complete Android tutorial for beginners
Sitting on my desk, I peek a glance at my colleague’s Nokia handset and begin to wonder when did ‘Android‘ become the new definition of ‘Connecting People’. I mean, think about it, solving the years-old problem of not being able to find a date with just an app, making it extremely easy for stress eaters to order in that hot chocolate fudge and eat their hearts out, allowing you to shop your favorite shoes with the tap of a click, Android is, in the truest sense, connecting people – to each other and to their utilities.
With the rampant emergence of technology and the growing number of Android users, Android app development is the new buzz in town. Two in every three engineering students can be seen talking about their career as an Android developer. So, here I am ‘connecting’ you with the foremost requisite to develop an Android app – the Android Studio!
What is Android Studio?
Before we delve deeper into Android Studio, let’s understand what an IDE is.
An IDE or Integrated Development Environment is a GUI-based workbench which aids developers in building software applications. To develop an app, you need a text editor to write your code, a compiler to execute your code, and a debugger to test your app. An IDE is a software that allows a developer to perform these functions and to run her app on a mobile device in real-time. Think of it as MS-Word or Excel which are in a way IDEs, allowing one to perform a specific purpose.
So, coming back to Android Studio, it is the official IDE for Android app development, based on IntelliJ. It was first announced in Google I/O conference in 2013. Android Studio allows a developer to write code in Java, Kotlin, and C/C++. Before Android Studio, Eclipse was the most popular IDE for developing Android apps. Android Studio largely focuses on accelerating your app development process and to ensure the same, it has a lot of cool features, some of which are listed below.
1. Gradle based build system – Android Studio uses a Gradle based system which is based on Groovy and Kotlin. Gradle supports the automatic download and reconfiguration of other libraries. It is a controller that allows one to use external libraries while writing an app. For instance, if you wish to improve the UI of an app, you can import external libraries on Android Studio using Gradle.
2. Support for C++ and NDK – Android Studio offers support for C/C++ code using the Native Development Kit (NDK). This means that one can use libraries written in C or C++ while coding their app and can run their code on a device rather than the Java Virtual Machine.
3. Kotlin lint checks – Since Google announced Kotlin as the official Android app development language, it has enhanced Kotlin language support in Android Studio. Android Studio 3.1 sees Lint code quality checks that can be run via the command line as well as from the IDE.
4. IntelliJ IDEA – Developers are not unfamiliar with unseeable errors in a code like a missing semicolon or incorrect variable declaration. Much like that elder sister who saves you when your parents catch you talking to your girlfriend, IntelliJ saves you from the pain of scrolling down for hours by suggesting relevant changes in your code.
To understand closely what Android Studio is, let’s talk about Android Software Development Kit or Android SDK. Android SDK is a set of tools that enable an Android developer to create Android apps. It comprises various libraries, APIs, debugger, and emulator among many others. The most important SDK tools are Android SDK Manager, Android Virtual Device Manager, and Dalvik Debug Monitor Server. For running these tools so as to create an app, one needs an IDE. For Android, Android Studio is that IDE.
Now, you know what an Android Studio is. So, let’s quickly install it in your system so that you can make a cool app and flaunt it to your parents – who knows they might stop nagging you about sitting in front of the laptop all the time!
Setting up Android Studio
a. System requirements – You can download Android Studio on Windows (32 and 64 bit), Linux (64 bit) and Mac (10.8.5 or higher)
b. Tool requirements – Java Development Kit which you can download here.
While downloading Android Studio, ensure that you have enough free space on your system and have already installed JDK. Download the latest version of Android Studio here. Along with the IDE, you get Android SDK, SDK Manager, and more such tools. If you are using Windows, download a .exe file and launch it. Follow the setup wizard in Android Studio and install the SDK packages it recommends. You can also see this step-by-step installation guide for Android Studio.
The Android Studio will show you a welcome screen, where you can click on Start a new Android project. A project defines your workspace for app development – from source code to build configurations. As soon as you select ‘New Project’, you’ll see a configuration screen where you set the name of your app, the domain name, and the location of the project in your system. If you want to code in C++ or Kotlin, check the checkboxes given on the bottom left of the page. Next, you’ll need to select your form versions and APIs as per the need of your project. Once you have a project running, you can start a new project any time during the app development by clicking on File → New → New Project.
The very next step will be to select an activity, which represents a single screen with which users interact to perform a specific task like clicking a picture or sending an email. You can select ‘Add no activity’ if you have the entire UI ready for your app. However, if you’re just beginning, you can select ‘Basic Activity’ – this will give you a blank app template. The next screen allows you to configure your activity by letting you add the activity name and layout name. As you click ‘Finish’, Android Studio opens the IDE.
The Android Studio opens with a text editor that has two windows: Kotlin/Java for functionality and XML for the user interface of the app. The app code (that provides functionality) will be written in the Kotlin/Java file which has the same name you chose for your activity. This name is MainActivity.kt by default. The layout or the UI of your app will be defined in the XML window, i.e. content_main.xml. To give you an example, if you want to create a hamburger menu, you’ll code it in the XML window, while to describe how this menu works, you’ll code in the Kotlin window.
The second phase involved in the app making process is build and run. This phase involves compiling the source code and app resources, packaging them into debuggable APKs, and running them on the emulator or a device powered by Android. Android Studio uses Gradle to manage the build process. The build files are named build.gradle. Gradle allows developers to customize, configure, and extend the build process along with creating multiple APKs without modifying the app’s source files.
To build and run your app, click ‘Run’ in the toolbar. Connect the device on which you wish to run your app using USB. Make sure that you have enabled the USB debugging option from your Android device. If you do not have a device, you can run your app on an emulator. The Android Emulator allows you to develop and test your apps in a run-time environment without using any Android-powered physical device. The emulator uses Android Virtual Device (AVD), a configuration that defines the characteristics of the Android device you wish to imitate in the emulator.
To mimic an Android device in the AVD manager, click Create New Virtual Device and set up the hardware profile, system image, storage, etc. To open the AVD manager, you can also click Tools → AVD Manager.
To run your app on an Android device of certain configurations, you’ll need a specific set of SDK tools. To download these tools on your IDE, click Tools → SDK Manager. The Android SDK Manager will let you download tools, platforms, and various other components you’d require to develop your Android application.
The next phase of the Android app development is debugging and testing. This involves modifying and rewriting certain parts of the code so as to remove the existing bugs from the app and optimizing the app performance. Once you’ve tested the app, you are ready to publish it, i.e. release it on the Google Play Store. Click on Build → Generate Signed APK to get the file (which contains your app’s resources) needed to upload to Google Play Store. Create the keystore password and click on ‘Release’ to make it available for the millions of users of Play Store. You can know more about signing your app here.
Doesn’t seem that daunting anymore, does it? Well, this was just the surface of Android Studio. To learn Android Studio in and out, you can visit Android Developers – the official Android tutorial for beginners. Android app development requires much more than the knowledge of Android Studio – you need to be comfortable with programming in Kotlin or Java and XML.
How to learn Android Studio and Android app development?
If you’re just a rookie in the field of Android app development, then you’re in for a surprise. What is it, you ask? It’s an Android tutorial that teaches you how to make an Android app in just 6 weeks. Yes, Internshala’s Android training is specifically designed for beginners to learn Android programming. From setting up JDK and Android Studio to building user interfaces using XML and adding functionalities using Kotlin, this Android training walks you through all the necessary T-points of the road to learning Android app development. Throughout the training, you learn to use Android Studio for developing an app and at the end of it, you make your own music player app.
With over 1 billion Android users and 2 million Android apps on Google Play, Android app development is the hottest industry. If you wish to become a part of this fastest growing industry, enroll in Internshala’s Android training to learn Android in just 6 weeks and get an additional discount of 10% on registering today!