如何设置 ANDROID_SDK_HOME 环境变量?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23042638/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I set ANDROID_SDK_HOME environment variable?
提问by OlegArsyonov
I'm working with Eclipse on Windows 7, x64. I'm getting an error when running ADT bundle of android development:
我正在 Windows 7 x64 上使用 Eclipse。运行 ADT android 开发包时出现错误:
Error: Error parsing the AVDs
Unable to get the Android SDK home directory.
Make sure the environment variable ANDROID_SDK_HOME is set up.
错误:解析 AVD 时出错
无法获取 Android SDK 主目录。
确保环境变量 ANDROID_SDK_HOME 已设置。
I know what the issue is. Is it because it is linked to a wrong directory C:users:????
我知道问题是什么。是不是因为它链接到了错误的目录 C:users:????
How do I set this environment variable android_sdk_home to the proper directory?
如何将此环境变量 android_sdk_home 设置为正确的目录?
Please give me precise steps on how to do it such as open cmd.exe
, type this etc. I'm not good at it, I've never coded anything other that websites.
请给我具体的操作步骤,例如打开cmd.exe
、输入等。我不擅长它,我从来没有编写过其他网站的代码。
回答by Yousha Aleayoub
ANDROID_HOME
ANDROID_HOME
Deprecated(in Android Studio), use ANDROID_SDK_ROOT
instead.
已弃用(在 Android Studio 中),请ANDROID_SDK_ROOT
改用。
ANDROID_SDK_ROOT
ANDROID_SDK_ROOT
Installation directory of Android SDKpackage.
Android SDK包的安装目录。
Example: C:\AndroidSDK
or ~/android-sdk/
示例:C:\AndroidSDK
或~/android-sdk/
ANDROID_NDK_ROOT
ANDROID_NDK_ROOT
Installation directory of Android NDKpackage. (WITHOUT ANY SPACE)
Android NDK包的安装目录。(没有任何空间)
Example: C:\AndroidNDK
or ~/android-ndk/
示例:C:\AndroidNDK
或~/android-ndk/
ANDROID_SDK_HOME
ANDROID_SDK_HOME
Location of SDK related data/userfiles.
SDK 相关数据/用户文件的位置。
Example: C:\Users\<USERNAME>\.android\
or ~/.android/
示例:C:\Users\<USERNAME>\.android\
或~/.android/
ANDROID_EMULATOR_HOME
ANDROID_EMULATOR_HOME
Location of emulator-specificdatafiles.
位置特定仿真器,数据文件。
Example: C:\Users\<USERNAME>\.android\
or ~/.android/
示例:C:\Users\<USERNAME>\.android\
或~/.android/
ANDROID_AVD_HOME
ANDROID_AVD_HOME
Location of AVD-specificdatafiles.
位置AVD-特定的数据文件。
Example: C:\Users\<USERNAME>\.android\avd\
or ~/.android/avd/
示例:C:\Users\<USERNAME>\.android\avd\
或~/.android/avd/
JDK_HOME
and JAVA_HOME
JDK_HOME
和 JAVA_HOME
Installation directory of JDK(aka Java SDK) package.
JDK(又名Java SDK)包的安装目录。
Note:This is used to run Android Studio(and other Java-based applications). Actually when you run Android Studio, it checks for JDK_HOME
then JAVA_HOME
environment variables to use.
注意:这用于运行 Android Studio(和其他基于 Java 的应用程序)。其实,当你运行Android Studio中,它会检查JDK_HOME
,然后JAVA_HOME
环境变量来使用。
回答by OlegArsyonov
If you face the same error, here are the step by step instructions:
如果您遇到同样的错误,以下是分步说明:
- Open control panel
- Then go to System
- Then go to Change Environment Variables of the User
- Then click create a new environment variables
- Create a new variable named ANDROID_SDK_HOME
- Set its value to your Android directory, like
C:/users/<username>/.android
- 打开控制面板
- 然后进入系统
- 然后转到更改用户的环境变量
- 然后点击创建新的环境变量
- 创建一个名为 ANDROID_SDK_HOME 的新变量
- 将其值设置为您的 Android 目录,例如
C:/users/<username>/.android
回答by Militant Saungweme
This worked for me:
这对我有用:
- Open control panel
- click System
- Then go to Change Environment Variables
- Then click create a new environment variables
- Create a new variable named ANDROID_HOME path C:\Android\sdk
- 打开控制面板
- 点击系统
- 然后转到更改环境变量
- 然后点击创建新的环境变量
- 创建一个名为 ANDROID_HOME 路径 C:\Android\sdk 的新变量
回答by e-cloud
open your adt and open preferences, then modify directory with your sdk dir, it may help you follow the pic link indication
打开您的广告并打开首选项,然后使用您的 sdk 目录修改目录,它可能会帮助您按照图片链接指示进行操作
回答by Hitesh Sahu
回答by oasisfleeting
Android SDK
安卓SDK
Installing the Android SDK is also necessary. The Android SDK provides you the API libraries and developer tools necessary to build, test, and debug apps for Android.
还需要安装 Android SDK。Android SDK 为您提供了为 Android 构建、测试和调试应用程序所需的 API 库和开发人员工具。
Cordova requires the ANDROID_HOME
environment variable to be set. This should point to the [ANDROID_SDK_DIR]\android-sdk
directory (for example c:\android\android-sdk).
Cordova 需要设置ANDROID_HOME
环境变量。这应该指向[ANDROID_SDK_DIR]\android-sdk
目录(例如 c:\android\android-sdk)。
Next, update your PATH to include the tools/ and platform-tools/ folder in that folder. So, using ANDROID_HOME
, you would add both %ANDROID_HOME%\tools
and %ANDROID_HOME%\platform-tools
.
接下来,更新您的 PATH 以在该文件夹中包含 tools/ 和 platform-tools/ 文件夹。因此,使用ANDROID_HOME
,您将同时添加%ANDROID_HOME%\tools
和%ANDROID_HOME%\platform-tools
。
Reference : http://ionicframework.com/docs/v1/guide/installation.html
参考:http: //ionicframework.com/docs/v1/guide/installation.html
回答by Divakar Rajesh
Although the above answers mostly get them right, there is one slight issue with them all.. Follow these steps and you are good to go
尽管上述答案大多是正确的,但它们都有一个小问题......按照这些步骤操作即可
- Right click on This PC -> Properties
- On the left pane select "Advanced System Settings"
- On the new window select -> Advanced tab
- Click on the "Environment Variables" button
- On the first top section click on the "New" button
- 右键单击此电脑-> 属性
- 在左侧窗格中选择“高级系统设置”
- 在新窗口中选择 -> 高级选项卡
- 单击“环境变量”按钮
- 在第一个顶部点击“新建”按钮
set variable name -> ANDROID_HOME
set variable value -> the custom location of the Android SDK
设置变量名称 -> ANDROID_HOME
设置变量值 -> Android SDK 的自定义位置
- Now click on the newly created variable name and in the box below select "Path" and click on the Edit button
- Now click on New and paste the location of the "platform-tools"
- Again click on New and paste the location of the "tools" You can find the locations of the above platform-tools and tools - they are generally inside the Android SDK folder
- MOST IMPORTANT OF ALL...
save all those by clicking ok If you are using the terminal(cmd) close it and open it again
- 现在单击新创建的变量名称,然后在下面的框中选择“路径”,然后单击“编辑”按钮
- 现在点击新建并粘贴“平台工具”的位置
- 再次点击新建并粘贴“工具”的位置,你可以找到上述平台工具和工具的位置——它们一般在Android SDK文件夹内
- 最重要的...
单击确定保存所有这些如果您正在使用终端(cmd)关闭它并再次打开它
回答by user3076495
from command prompt:
从命令提示符:
set ANDROID_SDK_HOME=C:\[wherever your sdk folder is]
设置 ANDROID_SDK_HOME=C:\[无论您的 sdk 文件夹在哪里]
should do the trick.
应该做的伎俩。