Differences

This shows you the differences between two versions of the page.

Link to this comparison view

dapm:laboratoare:01 [2019/02/18 14:56]
george.stoica0310
dapm:laboratoare:01 [2021/03/07 09:26] (current)
ioana_maria.culic
Line 1: Line 1:
-===== Laboratorul ​01=====+===== Lab 01 - Install Android Studio ​=====
 ==== Objectives ==== ==== Objectives ====
   * Install and use the Android Studio IDE.   * Install and use the Android Studio IDE.
Line 25: Line 25:
   - Open Android Studio if it is not already opened.   - Open Android Studio if it is not already opened.
   - In the main **Welcome to Android Studio** window, click **Start a new Android Studio project**.   - In the main **Welcome to Android Studio** window, click **Start a new Android Studio project**.
-  - In the **Create New Project** window, choose **Empty Activity** for the **Phone or Tablet**.+  - In the **Create New Project** window, choose **Empty Activity** for the **Phone or Tablet** ​and click **Next**: ​          ​{{:​dapm:​laboratoare:​lab01_choose_empty_activity.png?400|400 }} 
 +  - In the **Configure your project** section, enter **Hello World** for the **Application Name**, leave the other settings to their default state{{:​dapm:​laboratoare:​lab01_hello_world_name.png?​400|400 }}
  
 +  - Click **Finish**
 +
 +Android Studio creates a folder for your projects, and builds the project with [[https://​gradle.org/​|Gradle]] (this may take a few moments).
 +
 +Tip: See the [[https://​developer.android.com/​studio/​build/​|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: 
 +{{:​dapm:​laboratoare:​lab01_project_opened.png?​500|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.
 +
 +  - 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.{{:​dapm:​laboratoare:​lab01_avd_manager.png?​400|400 }}
 +  - 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**).{{:​dapm:​laboratoare:​lab01_select_hardware.png?​400|400 }}
 +  - Choose a device such as **Nexus 5x** or **Pixel XL**, and click **Next**. The **System Image** screen appears.
 +  - 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**).{{:​dapm:​laboratoare:​lab01_emulator_system_image.png?​400|400 }}
 +  - 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
 +  - In Android Studio, choose **Run** > **Run app** or click the Run icon {{:​dapm:​laboratoare:​run_app.png?​15|15}} ​ in the toolbar.
 +  - The **Select Deployment Target** window, under **Available Virtual Devices**, select the virtual device, which you just created, and click **OK**{{:​dapm:​laboratoare:​lab01_select_deployment_target.png?​400|400 }}
 +
 +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.
 +{{:​dapm:​laboratoare:​lab01_app_running.png?​200|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===
 +  - Make the app display your name instead of the Hello World message
 +  - Run the app on a physical device instead of the emulator
dapm/laboratoare/01.1550494579.txt.gz · Last modified: 2019/02/18 14:56 by george.stoica0310
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