Lab 01 - Install Android Studio

Objectives

  • Install and use the Android Studio IDE.
  • Use the development process for building Android apps.
  • Create a simple Hello World Android project.

Installing Android Studio

Android Studio provides a complete integrated development environment (IDE) including an advanced code editor and a set of app templates. In addition, it contains tools for development, debugging, testing, and performance that make it faster and easier to develop apps. You can test your apps with a large range of preconfigured emulators or on your own mobile device, build production apps, and publish on the Google Play store.

Android Studio is available for computers running Windows or Linux, and for Macs running macOS. The newest OpenJDK (Java Development Kit) is bundled with Android Studio.

To get up and running with Android Studio, first check the system requirements to ensure that your system meets them. The installation is similar for all platforms. Any differences are noted below.

Steps for installation

  1. Navigate to the Android developers site and follow the instructions to download and install Android Studio.
  2. Accept the default configurations for all steps, and ensure that all components are selected for installation.
  3. After finishing the install, the Setup Wizard will download and install some additional components including the Android SDK. Be patient, this might take some time depending on your Internet speed, and some of the steps may seem redundant.
  4. When the download completes, Android Studio will start, and you are ready to create your first project.

Installation videos

Below are installation videos for different platforms:

Create a Hello World app

Create the app project

  1. Open Android Studio if it is not already opened.
  2. In the main Welcome to Android Studio window, click Start a new Android Studio project.
  3. In the Create New Project window, choose Empty Activity for the Phone or Tablet and click Next: 400
  4. In the Configure your project section, enter Hello World for the Application Name, leave the other settings to their default state400
  1. Click Finish

Android Studio creates a folder for your projects, and builds the project with Gradle (this may take a few moments).

Tip: See the Configure your build developer page for detailed information.

You may also see a “Tip of the day” message with keyboard shortcuts and other useful tips. Click Close to close the message.

If you made all the previous steps correctly, you should see something like this: 500

Use a virtual device (emulator)

For the Hello World app will use the Android Virtual Device (AVD) manager to create a virtual device (also known as an emulator) that simulates the configuration for a particular type of Android device, and use that virtual device to run the app. Note that the Android Emulator has additional requirements beyond the basic system requirements for Android Studio.

Using the AVD Manager, you define the hardware characteristics of a device, its API level, storage, skin and other properties and save it as a virtual device. With virtual devices, you can test apps on different device configurations (such as tablets and phones) with different API levels, without having to use physical devices.

Create an Android virtual device (AVD)

In order to run an emulator on your computer, you have to create a configuration that describes the virtual device.

  1. In Android Studio, select Tools > AVD Manager. Your Virtual Devices screen appears. If you've already created virtual devices, the screen shows them (as shown in the figure below); otherwise you see a blank list.400
  2. Click the +Create Virtual Device. The Select Hardware window appears showing a list of pre configured hardware devices. For each device, the table provides a column for its diagonal display size (Size), screen resolution in pixels (Resolution), and pixel density (Density).400
  3. Choose a device such as Nexus 5x or Pixel XL, and click Next. The System Image screen appears.
  4. Click the Recommended tab if it is not already selected, and choose which version of the Android system to run on the virtual device (such as Oreo).400
  5. After choosing a system image, click Next. The Android Virtual Device (AVD) window appears. You can also change the name of the AVD. Check your configuration and click Finish.

Run the app on the virtual device

Now we will run the Hello World app

  1. In Android Studio, choose Run > Run app or click the Run icon 15 in the toolbar.
  2. The Select Deployment Target window, under Available Virtual Devices, select the virtual device, which you just created, and click OK400

The emulator starts and boots just like a physical device. Depending on the speed of your computer, this may take a while. Your app builds, and once the emulator is ready, Android Studio will upload the app to the emulator and run it.

You should see the Hello World app as shown in the following figure. 200

Tip: When testing on a virtual device, it is a good practice to start it up once, at the very beginning of your session. You should not close it until you are done testing your app, so that your app doesn't have to go through the device startup process again. To close the virtual device, click the X button at the top of the emulator, choose Quit from the menu, or press Control-Q in Windows or Command-Q in macOS.

Bonus

  1. Make the app display your name instead of the Hello World message
  2. Run the app on a physical device instead of the emulator
dapm/laboratoare/01.txt · Last modified: 2021/03/07 09:26 by ioana_maria.culic
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0