ANDROID_SDK_HOME设置

Posted lucky

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ANDROID_SDK_HOME设置相关的知识,希望对你有一定的参考价值。

创建、删除和浏览AVD之前,通常应该先为android SDk设置一个环境变量:

ANDROID_SDK_HOME,该环境变量的值为磁盘上一个已有的路径。

如果不设置环境变量,开发者创建的蓄意设备默认保存在

C:\Documents and Settings\<user_name>r\.android目录下;

如果设置了ANDROID_SDK_HOME环境变量,那么虚拟设备就会保存在%ANDROID_SDK_HOME%/.android路径下。

这里有一点非常容易混淆的地方,此处的%ANDROID_SDK_HOME%环境变量并不是Android SDK的安装目录。

设置方法:用户变量

在环境变量里新建一个变量名:ANDROID_SDK_HOME,值为sdk的目录,

然后编辑PATH,增加一个值 “%ANDROID_SDK_HOME%\tools”,

用命令行测试android,看看能否启动android sdk and avd manager程序,成功后重启eclipse,

查看window-perferences-android-build ,看default debug keystore 是否指向 ANDROID_SDK_HOME的位置。

 

If you face the same error, here are the step by step instructions:

  1. Open control panel
  2. Then go to System
  3. Then go to Change Environment Variables of the User
  4. Then click create a new environment variables
  5. Create a new variable named ANDROID_SDK_HOME
  6. Set its value to your Android directory, like C:/users/<username>/.android

1.在环境变量中新建一个“系统变量”

  变量名:ANDROID_SDK_HOME

      值:K:\Android\android-sdk-windows\tools(注:我的sdk安装在K盘)

2.修改系统变量Path,在前面添加%Android_SDK_HOME%/tools;

 

重启eclipse,查看

window-perferences-android-build

default debug keystore:成功指向了K:\Android\android-sdk-windows\tools\.android\debug.keystore

 

2.安卓环境变量的配置。
下面我来介绍给大家环境变量的搭建、第一个是ANDROID_SDK_HOME: 路径系统变量设置:第二个是Path:路径系统变量设置。

 


第一步

ANDROID_SDK_HOME 路径:先介绍相对路径设置,不废话,变量名:ANDROID_SDK_HOME,变量值是android-SDK-windows的路径.

 

 

第二步
下面我们新建一个Path变量,
变量值方框里输入.;%ANDROID_SDK_HOME%\platform-tools;%ANDROID_SDK_HOME%\tools; 
需要注意的是最前面的.一定要有两个%中间代表引用ANDROID_SDK_HOME的路径,
然后将tools和platform-tools添加,不同的变量值之间用;隔开,注意中英文的分号不一样滴。

2.1来介绍下相对路径设置。

Path相对路径值:.;%ANDROID_SDK_HOME%\platform-tools;%ANDROID_SDK_HOME%\tools

 

 

第三步
2.2来介绍下绝对路径设置。
其实更简单,设置变量名:Path,变量值设置:.;I:\Android\android-sdk-windows\platform-tools;I:\Android\android-sdk-windows\tools。(不要忘记了前面有点和分号,都是在英文输入法下)

按照你自己安装的platform-tools和tools的路径设置。

 

 

I faced the same problem, which nearly drove me crazy.

System: Win7 64Bit, Eclipse/ADK 64 Bit, JRE7 64 Bit - latter copied from C:Programs\Java\ as "jre" under the Eclipse folder...

(finally Eclipse started).

How I solved the lacking start of the Emulator with an android virtual device:

  1. Look under C:Users\YourUserName\ .android if you can find there a folder named \avd containing subfolders named after the android virtual devices you created. 
    If that is not the case (as it was on my machine) then you probably have moved long ago your account‘s user data via a symbolic link to some different location, 
    as it was the case in my system. 
    Eclipse (the virtual device manager of the ADK) will create the virtual devices there, 
    but will search for them in the Windows default C:Users\YourUserName\ .android path.

  2. Locate the real folder with your user data, in my case it was: 
    D:\Win\Users\YourUserName where I finally found the AVD-folders needed for Eclipse: 
    D:\Win\Users\YourUserName\ .android\avd...
    (2 Subfolders with the avd‘s)

  3. Just copy the avd-folder (in my Example) 
    D:\Win\Users\YourUserName\ .android\avd to the "usual" Location, where Eclipse looks for it, 
    to C:\Users\YourUserName\ .android

This enabled me to : Start the virtual device and to load the Hello World example from Eclipse into it.

What did not help: 

Create an environment variable named ANDROID_SDK_HOME with the value D:\Win\YourUserName\ .android 
and add it to the environment variable paths list: 
path= ....;%ANDROID_SDK_HOME%;....

Eclipse does not seem to search for such environment variables, 
but obviously rather relies on the presence of all of the files in the Windows default locations of the user‘s personal data.

cheers

























以上是关于ANDROID_SDK_HOME设置的主要内容,如果未能解决你的问题,请参考以下文章

如何设置android sdk 的环境变量

环境变量不起作用

栗染-安卓环境变量配置

如何通过代码设置片段标签?

VSCode插件开发全攻略代码片段设置自定义欢迎页

错误代码:错误域 = NSCocoaErrorDomain 代码 = 3840“JSON 文本没有以数组或对象和允许未设置片段的选项开头。”