Using the Android tools directly from Terminal (Mac OS)
I’ve recently noticed that using android tools like the adb or the emulator directly from the terminal weren’t as common as I thought it would be.
It can be a bit tricky at first to configure but aftward you’ll see that it’s really handy for development.
- Launch the Terminal app
- Open the bash_profile
nano ~/.bash_profile
- Add your Android SDK path:
export ANDROID_SDK_ROOT=/Users/${whois}/Library/Android/sdk export PATH=$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/tools:$PATH
- Press ctrl+x followed by y and enter to save your changes.
That’s it, you’re all set! 🙌
Oh, and you don’t need to launch the Terminal app you can use the one that’s already built-in Android Studio:
Now feel free to try out some of the most common adb commands:
Or using the emulator:
emulator -list-avds
emulator @<your_emulator_name> -dns-server 8.8.8.8