无法找到'ANDROID_HOME'环境变量 [英] Failed to find 'ANDROID_HOME' environment variable

查看:2634
本文介绍了无法找到'ANDROID_HOME'环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个离子android项目,我安装了android sdk。

I am trying to build an ionic-android project and i have android sdk installed.

我的项目名称是myApp.I已经成功添加了android平台到myApp。但是当我试图构建项目时

The name of my project is myApp.I have successfully added android platform to myApp. But when i tries to build the project

~/myApp$ sudo ionic build android

结果是

Running command: /home/hari/myApp/hooks/after_prepare/010_add_platform_class.js /home/hari/myApp
  add to body class: platform-android
  ERROR building one of the platforms: Failed to find 'ANDROID_HOME'  environment variable. Try setting setting it manually.
  Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
You may not have the required environment or OS to build this project
Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.

查看ANDROID_HOME和PATH变量

see the ANDROID_HOME and PATH variable

echo $ANDROID_HOME
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/hari/Android/Sdk

echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/hari/Android/Sdk/tools:/home/hari/Android/Sdk/platform-tools:/usr/local/bin:/opt/gradle/bin

我在堆栈上看到几乎相同的问题溢出,但没有一个适合我。我的android-sdk配置有什么问题吗?我该如何建立这个项目?

I have seen almost the same kind of questions on stack overflow, but none works for me. Is there anything wrong with my android-sdk configuration? How can i build this project?

推荐答案

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

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

spring.io 引用:


设置Android开发环境



在构建Android应用程序之前,必须安装
Android SDK。安装Android SDK还会安装AVD Manager,
a图形用户界面,用于创建和管理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 / tools ANDROID_HOME / platform-tools

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



Mac OS X

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



Linux



Linux

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



Windows



Windows

set ANDROID_HOME=C:\<installation location>\android-sdk-windows
set PATH=%PATH%;%ANDROID_HOME%\tools;%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 Manager 窗口:

android

注意:如果此命令无法打开 Android SDK管理器
那么您的路径未正确配置。

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

选择工具复选框。

选中最新Android SDK 的复选框。

其他文件夹中选择 Android支持库的复选框。

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

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

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

注意:您可能希望安装所有可用的更新,但是b $ b意识到需要更长的时间,因为每个API级别都是大量下载/ p>

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.


这篇关于无法找到'ANDROID_HOME'环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆