可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I set the c:/android-sdk/tools path to the path environment and commands like 'emulator' is working just fine. But the adb command is still not recognized , what should I do ?
I the path system variable I added the android-sdk path and the tools path so far. Is there something else that need to be done ? cause commands like adb devices doesn't works it says that the command is not recognized. By the way I want to do adb install comeapp.apk...
Thanks
回答1:
If you go to your android-sdk/tools folder I think you'll find a message :
The adb tool has moved to platform-tools/
If you don't see this directory in your SDK, launch the SDK and AVD Manager (execute the android tool) and install "Android SDK Platform-tools"
Please also update your PATH environment variable to include the platform-tools/ directory, so you can execute adb from any location.
So you should also add C:/android-sdk/platform-tools to you environment path. Also after you modify the PATH variable make sure that you start a new CommandPrompt window.
回答2:
You have two ways:
First go to the particular path of Android SDK:
1) Open your command prompt and traverse to the platform-tools directory through it such as
$ cd Frameworks\Android-Sdk\platform-tools
2) Run your adb commands now such as to know that your adb is working properly :
$ adb devices OR adb logcat OR simply adb
Second way is :
1) Right click on your My Computer.
2) Open Environment variables.
3) Add new variable to your System PATH variable(Add if not exist otherwise no need to add new variable if already exist).
4) Add path of platform-tools directory to as value of this variable such as C:\Program Files\android-sdk\platform-tools.
5) Restart your computer once.
6) Now run the above adb commands such adb devices or other adb commands from anywhere in command prompt.
Also on you can fire a command on terminal setx PATH "%PATH%;C:\Program Files\android-sdk\platform-tools"
回答3:
If you get your adb from Android Studio (which most will nowadays since Android is deprecated on Eclipse), your adb program will most likely be located here:
%USERPROFILE%\AppData\Local\Android\sdk\platform-tools
Where %USERPROFILE% represents something like C:\Users\yourName.
If you go into your computer's environmental variables and add %USERPROFILE%\AppData\Local\Android\sdk\platform-tools to the PATH (just copy-paste that line, even with the % --- it will work fine, at least on Windows, you don't need to hardcode your username) then it should work now. Open a new command prompt and type adb to check.