Saturday, October 4, 2014

Tutorial 2 : Hello World

In this tutorial, I will show you how to run the Android Studio and create a simple "Hello World" project with Android Virtual Device (AVD).

1. Project Setup

If you were successfully install Android Studio in your desktop or laptop, then your development environment should be set up correctly. Now you are ready to create your first Android application by using Android Studio.When you launch Android Studio, you should see a welcome screen is shown as Figure 2.1 which offering you several choices to start with it.

Figure 2.1



Now, we were going to choose New Project, this will show you a list of options to configure your new project. In this tutorial, we were creating a simple application to show you Android Studio's features.

Figure 2.2

As you see in the above screenshot, I would like to name this application as HelloWorld and select the location for the project. After you done it, then click next to proceed.

Figure 2.3

At this section, you need to choose the minimum and target SDK version that your project will be compiled with. Then, proceed to next for select the project's activity class which you would like to use.

Figure 2.4

Now, you can choose whether the project supports fullscreen activity, google map activity, action bar activity or others. This depends on which kind of application you would like to create. In this tutorial, we would like to start with a blank activity class.

Figure 2.5

In the last part of setup process, you were asked to name the Activity class, layout name and title of project. I named this activity shown as above screenshot. Click finish button when you done it. You will be presented with Android Studio's user interface as below and it is the time to explore more key features of Android Studio.

Figure 2.6

2. Software Development Kit (SDK) Manager

Before proceed to the run the application on Android Virtual Devices (AVD), you need to download the desired package for your platform such as Android 4.4W (API 20), Android 4.4.2 (API 19), Android 4.3.1 (API 18) and so on. The best way to open SDK Manager is selecting Tools > Android > SDK Manager in the Android Studio.

Figure 2.7

Then, the Android SDK Manager will be pop out and shown as below. Therefore, select the desired package you want to apply in your AVD. In this tutorial, I used Android 4.0.3 (API 15) as my platform and click install packages to download it if you don't have it.

Figure 2.8

3. Android Virtual Devices (AVD)

An AVD is an emulator configuration that allow you to model an Android device. By using it, this makes running and testing applications on devices much easier. With it, you can specify the hardware and software configurations which needed to emulate by Android Emulator.

The best way to create an AVD is through the AVD Manager,  by selecting Tools > Android > AVD Manager in the Android Studio.

Figure 2.9

if you done it correct, you should able to see the Android Virtual Device Manager similar to the screenshot below.

Figure 2.10

Now, create a new AVD by click on the Create button on the right hand side. A configuration window will be shown as below. Fill in all the needed information and click OK to create your first AVD.

Figure 2.11

To the newly created AVD, select it form the list in the AVD manager and click Start button on the right hand side. The Android Emulator should launch as shown in the screenshot below.

Figure 2.12

After you successfully launch the Android Emulator, it's time to launch your application by selecting Run from the menu. That is how easy it is to run an application in Android Emulator and you should be the output as below.


Figure 2.13

Figure 2.14

Now you are successfully to create a simple 'HelloWorld' Android application, proceed to the next tutorial to have more fun for customizing your own application.

No comments:

Post a Comment