简体   繁体   中英

android-sdk: android cmd not working globally

I've installed the Android SDK and faced this problem: I can execute cmd android only inside %PATH_TO_SDK%/tools folder. Here is my PATH:

C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Android\android-sdk\tools;C:\Program Files (x86)\Android\android-sdk\platform-tools;C:\ProgramData\Oracle\Java\javapath;c:\program files\graphicsmagick-1.3.21-q16;C:\Program Files\ImageMagick-6.9.2-Q16;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\dvurechenskii_aa\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\GitExtensions\;C:\Program Files (x86)\Skype\Phone\;C:\Users\dvurechenskii_aa\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Microsoft Emulator Manager\1.0\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 ^& MySQL Utilities 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 ^& MySQL Utilities 1.5\Doctrine extensions for PHP\;

and ANDROID_HOME:

C:\Program Files (x86)\Android\android-sdk\

what did i miss?

OS: windows 8.1

You seem to have added the environment variables perfectly fine. android/sdk in ANDROID_HOME and $ANDROID_HOME/tools and $ANDROID_HOME/platform_tools go in PATH variable.

Please note,if you have android studio installed and using windows, Android sdk is usually installed in C:\\Users\\YOUR_USERNAME\\AppData\\Local\\Android\\android-studio\\sdk. And you will have to use this as your ANDROID_HOME path for it to work.

After you update the path, please make sure you restart your terminal/command prompt in order to take in the updated system variables

I have resolve the problem by using these steps:

  1. Go to: Start > Run > Type: sysdm.cpl
  2. Once press enter, go to tabs: Advanced > Enviroment Variables...
  3. Add new settings to System Variables
  4. Put the new settings like this and click OK:
Variable name: ANDROID_HOME
Variable value: C:\Users\[PC NAME]\AppData\Local\Android\sdk
  1. Find the path variable and click edit, just add this line (do not delete the previous settings)
%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

There you go, you need to close your command prompt and reopen it

Was tested on WINDOWS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM