adb command not found

后端 未结 20 2415
刺人心
刺人心 2020-12-22 15:32

I need to run an adb forward command before I could use the ezkeyboard application which allows user to type on the phone using browser.

When

20条回答
  •  甜味超标
    2020-12-22 16:31

    + The reason is: you are in the wrong directory (means it doesn't contain adb executor).

    + The solution is (step by step):

    1) Find where the adb was installed. Depend on what OS you are using.

    Mac, it could be in: "~/Library/Android/sdk/platform-tools"

    or

    Window, it could be in: "%USERPROFILE%\AppData\Local\Android\sdk\platform-tools\".

    However, in case you could NOT remember this such long directory, you can quickly find it by the command "find". Try this in your terminal/ command line, "find / -name "platform-tools" 2> /dev/null" (Note: I didn't test in Window yet, but it works with Mac for sure).

    *Explain the find command,

    • Please note there is a space before the "/" character --> only find in User directory not all the computer.
    • "2> /dev/null" --> ignore find results denied by permission. Try the one without this code, you will understand what I mean.

    2) Go to where we installed adb. There are 3 ways mentioned by many people:

    • Change the PATH global param (which I won't recommend) by: "export PATH=~/Library/Android/sdk/platform-tools" which is the directory you got from above. Note, this command won't print any result, if you want to make sure you changed PATH successfully, call "export | grep PATH" to see what the PATH is.

    • Add more definition for the PATH global param (which I recommend) by: "export PATH=~/Library/Android/sdk/platform-tools:$PATH" or "export PATH=$PATH:~/Library/Android/sdk/platform-tools"

    • Go to the path we found above by "cd ~/Library/Android/sdk/platform-tools"

    3) Use adb:

    • If you change or update the PATH, simply call any adb functions, since you added the PATH as a global param. (e.g: "adb devices")

    • If you go to the PATH by cd command, call adb functions with pre-fix "./ " (e.g: "./ adb devices")

提交回复
热议问题