且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

未能找到“ANDROID_HOME"环境变量

更新时间:2021-09-23 21:36:15

您可能需要确认您的开发环境已正确设置.

You may want to confirm that your development environment has been set correctly.

引自 spring.io:

在构建 Android 应用程序之前,您必须安装安卓软件开发工具包.安装 Android SDK 也会安装 AVD Manager,用于创建和管理 Android Virtual 的图形用户界面设备 (AVD).

Set up the Android development environment

Before you can build Android applications, you must install the Android SDK. Installing the Android SDK also installs the AVD Manager, a graphical user interface for creating and managing Android Virtual Devices (AVDs).

  1. Android 网站,下载适用于您的操作系统的正确版本的 Android SDK.

  1. From the Android web site, download the correct version of the Android SDK for your operating system.

将存档解压缩到您选择的位置.例如,在 Linux 或 Mac 上,您可以将其放在用户目录的根目录中.看Android开发者有关其他安装详细信息的网站.

Unzip the archive to a location of your choosing. For example, on Linux or Mac, you can place it in the root of your user directory. See the Android Developers web site for additional installation details.

根据 Android SDK 的位置配置 ANDROID_HOME 环境变量.此外,考虑添加ANDROID_HOME/toolsANDROID_HOME/platform-tools 到您的 PATH.

Configure the ANDROID_HOME environment variable based on the location of the Android SDK. Additionally, consider adding ANDROID_HOME/tools, and ANDROID_HOME/platform-tools to your PATH.

Mac OS X

export ANDROID_HOME=/<installation location>/android-sdk-macosx
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Linux

export ANDROID_HOME=/<installation location>/android-sdk-linux
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

视窗

set ANDROID_HOME=C:<installation location>android-sdk-windows
set PATH=%PATH%;%ANDROID_HOME%	ools;%ANDROID_HOME%platform-tools

Android SDK 下载不包括特定的 Android 平台.要运行本指南中的代码,您需要下载并安装最新的SDK平台.您可以使用 Android SDK 和 AVD 来完成此操作您在上一节中安装的管理器.

The Android SDK download does not include specific Android platforms. To run the code in this guide, you need to download and install the latest SDK platform. You do this by using the Android SDK and AVD Manager that you installed in the previous section.

  1. 打开 Android SDK 管理器窗口:

android

注意:如果这个命令没有打开Android SDK Manager,那么你的路径配置不正确.

Note: If this command does not open the Android SDK Manager, then your path is not configured correctly.

选中工具复选框.

选中最新 Android SDK 的复选框.

Extras 文件夹中,选中 Android 支持库 的复选框.

From the Extras folder, select the checkbox for the Android Support Library.

点击安装包...按钮完成下载和安装.

Click the Install packages... button to complete the download and installation.

注意:您可能想要安装所有可用的更新,但意识到这将需要更长的时间,因为每个 API 级别都是一次大下载.

Note: You may want to install all the available updates, but be aware it will take longer, as each API level is a large download.