How do I run adb on a mac terminal?

前端 未结 6 1310
一个人的身影
一个人的身影 2021-02-02 07:29
adb shell run-as /data/data/com.mypackagename 

returns

adb command not found

though I see adb in the dir

相关标签:
6条回答
  • 2021-02-02 07:34

    If you are in that directory, you can run it with a leading dot-slash, i.e. ./adb shell run-as /data/data/com.mypackagename.

    In general, you might want to add that directory to your PATH environment variable.

    0 讨论(0)
  • 2021-02-02 07:36

    If you are using Catalina:

    echo 'export PATH=$PATH:~/Library/Android/sdk/platform-tools/' >> ~/.zshrc
    source ~/.zshrc
    adb devices
    
    0 讨论(0)
  • 2021-02-02 07:44

    You just need to add this path to your bash profile and source it:

    echo 'export PATH=$PATH:~/Library/Android/sdk/platform-tools/' >> ~/.bash_profile
    
    source ~/.bash_profile
    
    adb devices
    
    0 讨论(0)
  • 2021-02-02 07:53

    For Xamarin Studio users, this is a copy/paste from the Xamarin forums

    From Xamarin Studio, go to Tools, then select "Open Android SDK Command Prompt". This will open a terminal window and automatically navigate you to the Android SDK location. From there you can use the ADB command.

    0 讨论(0)
  • 2021-02-02 07:57

    The first step, you should get android sdk directory path by open:

    Android Studio -> Preferences -> Appearance & Behavior -> System Settings -> Android SDK

    The path will be show here. example: /Users/thisismyaccount/Library/Android/sdk

    Next, you open Terminal and type command as below:

    echo 'export PATH=$PATH:/Users/*thisismyaccount*/Library/Android/sdk/platform-tools/' >> ~/.bash_profile
    
    source ~/.bash_profile
    
    adb devices
    
    0 讨论(0)
  • 2021-02-02 07:57

    As HuyTTQ said, first check your android SDK path.

    Then export it:

    export ADB="/Users/your_username/Library/Android/sdk/platform-tools/adb"
    
    $ADB devices
    

    this will only work temporarily for this opened terminal.

    0 讨论(0)
提交回复
热议问题