adb shell run-as /data/data/com.mypackagename
returns
adb command not found
though I see adb in the dir
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.
If you are using Catalina:
echo 'export PATH=$PATH:~/Library/Android/sdk/platform-tools/' >> ~/.zshrc
source ~/.zshrc
adb devices
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
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.
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
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.