Android tutorial: How to develop an Android app

From your first line of code, to your first day on the job — Educative has you covered. Join 2M+ developers learning in-demand programming skills.

Android development is all the hype these days as it continues to dominate the world of mobile development. Fun projects, great pay, and tons of job prospects are just some of the reasons developers are starting their journeys into the exciting world of the Android operating system.

Some experts say that there has never been a better time to learn Android skills, especially since the recent updates, like the addition of Kotlin and improvements to Google’s policies.

Today we will walk you through all the basics of Android development and even show you how to build your own functioning application.

Here’s what we’ll cover today:

Become an Android developer the easy way.

Learn modern Android development with a hands-on, project-based course that walks through every stage of development.

What is Android?

Android is one of my world’s most popular operating systems for everything from 5G mobile devices to mobile apps to touchscreen smartphones and tablets. This open-source, Linux-based software is used by Google to power over 2.5 billion devices worldwide, accounting for over 80% of smartphone sales.

Android is based on the Linux kernel, which means that the basic operating structure is portable, multi-user, and able to handle complex multitasking. One of the biggest advantages of Android is the freedom of choice that comes with the technology. Not only is the hardware more diverse, but the software is very flexible and customizable.

The market for Android development is growing as more and more manufacturers, including Samsung, Lenovo, HTC, and LG, turn to Android to power their products. This means that there’s a huge demand for Android developers worldwide in diverse industries and companies!

On top of that, the new Google Play Store policies are the app development market much more lucrative. Learning Android skills will open doors and make you a desirable developer across the board.

Android development tools

Getting started as an Android developer is easier than you might think; you’ll need to master some basic skills and tools, such as:

Programming Language Skills

There are three programming languages and one markup language used in Android development.

Java is the official language for Android development and one of the most popular programming languages in the world. Java classes run on Android Runtime (ART), a specialized virtual machine. Take a look at this example from the Android MainActivity.java file.

public class MainActivity extends AppCompatActivity
@Override
protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView mainTextView = findViewById(R.id.mainTextView);
mainTextView.setText("Hello educative.io");
>
>

Kotlin has been the second official language for Android development since 2017. Known for being much more concise and expressive, Kotlin helps alleviate some of Java’s drawbacks. Here’s an example of the above code in Kotlin so you can compare.

public class MainActivity : AppCompatActivity
override fun onCreate(savedInstanceState: Bundle)
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val mainTextView = findViewById(R.id.mainTextView)
mainTextView.text = "Hello educative.io"
>
>

If you want to learn more about Kotlin, take a look at our article here to catch up on the basics.

XML, a markup language, is commonly used in Android development to declare a layout for user interface (UI), dimensions, and strings. Take a look at this example of a layout that shows text in the middle of the user’s screen.

 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

Android Build System

Gradle powers the Android build automation system and expands upon the concepts of Apache Maven and Apache Ant by introducing a Groovy-based, domain-specific language. Groovy is an optionally typed, dynamic language with static-typing capabilities. It helps improve productivity and speed by integrating with your Java-based program. With Groovy’s ease and Gradle’s mature ecosystem, you can automate your software and deliver much faster builds.

Android Studio IDE

The Android Studio IDE is your new best friend for Android development. Based on IntelliJ IDEA, it’s the official development environment for Google’s operating system. It comes with great Android-specific tooling to cover all your needs. Using this IDE will accelerate your development time, and frequent updates mean you’ll never fall behind. It comes loaded with the following features, amongst many others:

Android SDK

The Android SDK is the official development kit for Android app development. It is composed of modular packages that can be separately downloaded from the Android SDK Manager, including SDK tool, Google API, Android support, Android Debug Bridge (ADB), and more. Just like the IDE, the Android SDK is always being updated. New releases will keep you up to date with the latest features.

How to develop an Android app

Java for Android

When it comes to creating Android apps, your knowledge of Java is paramount to your success. Java is the official language for developing Android applications, and it supports all of the Android tools. Knowledge of this language will make your dev experience much easier.

Java was chosen for Android development because it is well-known, well-supported by development tools, and already pervasive in the mobile phone industry. On top of that, Java runs in a VM, so it doesn’t need to be recompiled.

Install Android Studio IDE

To get started with Android development, you need to install the Android Studio IDE. This user-friendly, drag-and-drop interface is the official IDE development environment. It is purpose-built for high-quality Android apps. This IDE will speed up your development time and make your apps far more reliable and easier to update when new features are released.

For Linux or Chrome OS installation, visit the documentation here.

To install Android Studio on Windows, follow these steps.

  1. Visit this link to get the latest version of Android Studio.
  2. You can either download the IDE as a .exe file or a .zip file. For the .exe file, double click the file to launch it. For the .zip file, unpack the ZIP and copy the android-studio folder to your Program files.
  3. This will prompt you to open and launch the android-studio > bin folder.
  4. Once prompted, follow the Android Studio setup wizard, where you can select your SDK packages.

To install Android Studio on Mac, follow these steps.

  1. Visit this link to get the latest version of Android Studio.
  2. Once downloaded, launch the DMG file and drag it to your Applications folder.
  3. Launch Android Studio . From here, you can either start a new project or import previous settings.
  4. Follow the setup wizard prompts to select your SDK components.

Keep the learning going.

Learn Android developmemnt without scrubbing through videos or documentation. Educative’s text-based course is easy to skim and features a live Android emulator - making learning quick and efficient.

Creating a Hello World Application

Step 1: Structure of an Android App

Now that we have our IDE, how do we actually make an Android project? First, let’s look at the structure of a typical Android project.