CodeLab:Android fundamentals 01.1:Android Studio and Hello World

本文是Android Developer Fundamentals课程的一部分,详细介绍了如何安装Android Studio并创建运行第一个Hello World应用。内容包括安装Android Studio、设置虚拟设备和物理设备、修改Gradle配置、添加日志语句等步骤,旨在帮助初学者熟悉Android开发环境和基本流程。
摘要由CSDN通过智能技术生成

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:

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:

在这里插入图片描述



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.

在这里插入图片描述

  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.

在这里插入图片描述

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值