In this tutorial, you’ll learn how to build your first Android app. This tutorial will teach you the basics of how to create an Android project with Android Studio development environment and run a debuggable version of the app. Android Studio is an easy to use and a free android app development environment. Before you start building Android app you must have a working basic knowledge of the Java programming language because it’s the official language and mostly used on Android. Nowadays Kotlin has become the official language on Android! because of its combination of simplicity and power. Kotlin is already beloved by many Android developers.

There won’t be much code used in this tutorial, so I will assume that you have enough Java knowledge to understand. This will hardly take your 30-60 minutes, depending on how quickly you are able to download and install Android Studio on your system. Check out the below-given system requirements for Android Studio. After using this tutorial to create your first Android app, you’ll be well on your way to a fun new hobby or possibly even a promising career in mobile development.

System Requirements

Windows

  • Microsoft® Windows® 7/8/10 (32- or 64-bit)
  • 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
  • 2 GB of available disk space minimum,
  • 4 GB Recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
  • 1280 x 800 minimum screen resolution

Mac

  • Mac® OS X® 10.10 (Yosemite) or higher, up to 10.13 (macOS High Sierra)
  • 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
  • 2 GB of available disk space minimum,
  • 4 GB Recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
  • 1280 x 800 minimum screen resolution

Linux

  • GNOME or KDE desktop
  • Tested on Ubuntu® 14.04 LTS, Trusty Tahr (64-bit distribution capable of running 32-bit applications)
  • 64-bit distribution capable of running 32-bit applications
  • GNU C Library (glibc) 2.19 or later
  • 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
  • 2 GB of available disk space minimum,
  • 4 GB Recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
  • 1280 x 800 minimum screen resolution

Before you start, download and install Android Studio.

Steps to Build your First Android App

1. In the Welcome to Android Studio window, click Start a new Android Studio project.
Welcome to Android Studio      Or if you have a project opened, select File > New Project.
2.  In the New Project screen, enter the following values:

  • Application Name: “My First App”
  • Company domain ⇒ “example.com” ( Eg: gadgetcreek.com)
  • Project location ⇒ choose a location for your project or else leave the other options as they are.

New Project Screen - Android Studio

Then Click Next.

3.  Under Select the form factors your app will run on, check the box for Phone and Tablet.

4.  For Minimum SDK, select API 14: Android 2.3.3 (IceCreamSandwich). click Next.

Select the form factors in Android Studio

5.  In the Add an Activity to Mobile screen, select Empty Activity and click Next.

Add Activity in Android Studio

6.  In the Configure Activity screen, keep the default values and click Finish.

Configure Activity in Android

After some processing, Android Studio opens the IDE.

Now take a moment to review the most important files.

First, be sure the Project window is open (select View > Tool Windows > Project) and the Project view is selected from the drop-down list at the top of that window.Android Studio Project View

Open the Main Activity file located under app > java > com.gadgetcreek.myfirstapp > MainActivity.java. This is the main activity (the entry point for your app). When you build and run the app, the system launches an instance of this Activity and loads its layout.Android Studio Main Activity

Open the layout file for main activity(activity_main.xml) located under app > res > layout > activity_main.xml. This XML file defines the layout for the activity’s UI. It contains a TextView element with the text “Hello world!”.Android Studio Activity Main XMLAndroid Manifest file located under app > manifests > AndroidManifest.xml. The manifest file describes the fundamental characteristics of the app and defines each of its components.Gradle Scripts > build.gradleYou’ll see two files with this name: one for the project and one for the “app” module. Each module has its own build.gradle file, but this project currently has just one module. You’ll mostly work with the module’s build.gradle file to configure how the Gradle tools compile and build your app.

To run the app from Android studio, click Run icon Eclipse Run Icon URL from the toolbar.

Run on a real device

  1. Make sure your device is connected to development machine with a USB cable. If you’re developing on Windows, you might need to install the appropriate USB driver for your device.
    • Open the Settings on your device.
    • Scroll to the bottom and select About phone.
    • Scroll to the bottom and tap Build number 7 times.
    • Return to the previous screen to find Developer options near the bottom.Enable USB debugging in the Developer options as follows.First, you must enable the developer options:
    • Open Developer options, and then scroll down to find and enable USB debugging.
  2. In the Select Deployment Target window, select your device, and click OK.
  3. Android Studio installs the My First App on your connected device and starts it.

Run on an emulator

  1. In the Select Deployment Target window, click Create New Virtual Device.
  2. In the Select Hardware screen, select a phone device, such as Pixel, and then click Next.
  3. In the System Image screen, select the version with the highest API level. If you don’t have that version installed, a Download link is shown, so click that and complete the download.
  4. Click Next.
  5. On the Android Virtual Device (AVD) screen, leave all the settings alone and click Finish.
  6. Back in the Select Deployment Target dialog, select the device you just created and click OK.
  7. Android Studio installs the My First App on the emulator and starts it.

NOTE:-  I would recommend you to run the app on the real device because emulator will take lots of memory of your system :).

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.