Runoob Tutorial ArchiveEnglish

Android Studio Installation

Android Studio Installation

Step 1 - System Requirements

You can start Android application development on the following operating systems:

All tools required for Android application development are open source and can be downloaded from the internet. The following is a list of software required before starting Android application programming:

Step 2 - Install Android Studio

Overview

Android Studio is the official IDE for developing Android applications, based on Intellij IDEA. You can download the latest version of Android Studio from the official website Android Studio Download. If you are new to installing Android Studio on Windows, find the file named android-studio-bundle-135.17407740-windows.exe and run it through the Android Studio setup wizard.

If you want to install Android Studio on Mac or Linux, you can download the latest version from Android Studio Mac Download or Android Studio Linux Download and check the instructions provided with the download file. This tutorial assumes you are installing your environment on Windows 8.1.

Installation

Ensure that Java JDK is installed before installing Android Studio. To install Java JDK, please refer to section Java Development Environment Configuration|.

After starting the Android Studio installation, you need to set the JDK 5 or later version path in the Android Studio installer.

The following image shows the initialization of JDK for Android SDK.

Check the components required to create an application; the image below selects "Android Studio", "Android SDK", "Android Virtual Device", and "Appearance (Intel chip)".

You need to specify the paths for Android Studio and Android SDK on your local machine. The figure below shows the default installation location on Windows 8.1 64-bit architecture.

Specify the default RAM space required by the Android emulator as 512M.

Finally, unzip the SDK package to your local machine, which will take some time and occupy 2626M of hard drive space.

After completing the above steps, you will see a finish button and can open the Android Studio project in the welcome screen, as shown in the figure below:

Start Android application development by calling "Start a new Android Studio project." On the new installation page, you are required to fill in the application name, package name information, and project path.

After entering the application name, start selecting the application's running environment parameters, where you need to specify the minimum SDK. In this tutorial, we select API 21: Android 5.0 (Lollipop).

android_android_studio_10

The next step in the installation is to select the mobile device activity to specify the default layout for the application.

android_android_studio_11

In the final stage, open the development tools to write the application code.

android_android_studio_12

Step 3 - Create an Android Virtual Device

An Android Virtual Device is required to test Android applications. Therefore, before starting to write code, create an Android Virtual Device. Click the AVD Manager icon in the image below to launch the Android AVD Manager.

android_android_studio_13

After clicking the virtual device icon, the default virtual devices available in the SDK will be displayed. Click the "Create new Virtual device" button to create a virtual device.

android_android_studio_14

If the AVD creation is successful, it means you are ready for Android application development. Click the close button in the upper right corner to close the window. After completing the last step, restart your machine. Before starting the first Android example, you need to understand some concepts related to Android application development.


Hello World Instance

Before writing the Hello World code, we need to know XML tags. Open the file at app > res > layout > activity_main.xml.

android_android_studio_15

The specific code is as follows:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

   xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"

   android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"

   android:paddingRight="@dimen/activity_horizontal_margin"

   android:paddingTop="@dimen/activity_vertical_margin"

   android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">



   <TextView android:text="@string/hello_world"

      android:layout_width="550dp"

      android:layout_height="wrap_content" />

</RelativeLayout>

Click Run > Run App to run the program, and the result is as follows: