CodeLab:Android fundamentals 01.1:Android Studio and Hello World

Android fundamentals 01.1:Android Studio and Hello World


Tutorial source : Google CodeLab
Date : 2021/04/06

Complete course : 教程目录 (java).

Note : The link in this article requires Google access


1、Welcome

This practical codelab is part of Unit 1: Get started in the Android Developer Fundamentals (Version 2) course. You will get the most value out of this course if you work through the codelabs in sequence:

  • For the complete list of codelabs in the course, see Codelabs for Android Developer Fundamentals (V2).
  • For details about the course, including links to all the concept chapters, apps, and slides, see Android Developer Fundamentals (Version 2).

Note: This course uses the terms “codelab” and “practical” interchangeably.

Introduction

In this practical you learn how to install Android Studio, the Android development environment. You also create and run your first Android app, Hello World, on an emulator and on a physical device.

What you should already know

You should be able to:

  • Understand the general software development process for object-oriented applications using an IDE (integrated development environment) such as Android Studio.
  • Demonstrate that you have at least 1-3 years of experience in object-oriented programming, with some of it focused on the Java programming language. (These practicals will not explain object-oriented programming or the Java language.)

What you’ll need

  • A computer running Windows or Linux, or a Mac running macOS. See the Android Studio download page for up-to-date system requirements.
  • Internet access or an alternative way of loading the latest Android Studio and Java installations onto your computer.

What you’ll learn

  • How to install and use the Android Studio IDE.
  • How to use the development process for building Android apps.
  • How to create an Android project from a template.
  • How to add log messages to your app for debugging purposes.

What you’ll do

  • Install the Android Studio development environment.
  • Create an emulator (virtual device) to run your app on your computer.
  • Create and run the Hello World app on the virtual and physical devices.
  • Explore the project layout.
  • Generate and view log messages from your app.
  • Explore the AndroidManifest.xml file.


2、App overview

After you successfully install Android Studio, you will create, from a template, a new project for the Hello World app. This simple app displays the string “Hello World” on the screen of the Android virtual or physical device.

Here’s what the finished app will look like:

CodeLab:Android fundamentals 01.1:Android Studio and Hello World_第1张图片



3、Task 1: Install 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.

Note: Android Studio is continually being improved. For the latest information on system requirements and installation instructions, see Android Studio.

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.

  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.

Troubleshooting: If you run into problems with your installation, check the Android Studio release notes, or get help from you instructors.



4、Task 2: Create the Hello World app

In this task, you will create an app that displays “Hello World” to verify that Android studio is correctly installed, and to learn the basics of developing with Android Studio.

2.1 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 Android Project window, enter Hello World for the Application name.

CodeLab:Android fundamentals 01.1:Android Studio and Hello World_第2张图片

  1. Verify that the default Project location is where you want to store your Hello World app and other Android Studio projects, or change it to your preferred directory.
  2. Accept the default android.example.com for Company Domain, or create a unique company domain.

If you are not planning to publish your app, you can accept the default. Be aware that changing the package name of your app later is extra work.

  1. Leave unchecked the options to Include C++ support and Include Kotlin support, and click Next.
  2. On the Target Android Devices screen, Phone and Tablet should be selected. Ensure that API 15: Android 4.0.3 IceCreamSandwich is set as the Minimum SDK; if it is not, use the popup menu to set it.

CodeLab:Android fundamentals 01.1:Android Studio and Hello World_第3张图片

These are the settings used by the examples in the lessons for this course. As of this writing, these settings make your Hello World app compatible with 97% of Android devices active on the Google Play Store.

  1. Leave unchecked the Include Instant App support and all other options. Then click Next. If your project requires additional components for your chosen target SDK, Android Studio will install them automatically.

  2. The Add an Activity window appears. An Activity is a single, focused thing that the user can

你可能感兴趣的:(Android,Fundamentals,android,java,android,studio)