【Mac/Android Studio】What is the adb command? How to make it available

【Mac/Android Studio】What is the adb command? How to make it available

What you will learn from this article

  • What is the adbcommand in Android Studio/Kotlin?
  • How to make it available on your Mac

index

[open]

\ アプリをリリースしました /

みんなの誕生日

友達や家族の誕生日をメモ!通知も届く-みんなの誕生日-

posted withアプリーチ

Official Reference: Viewing logs with Logcat

Environment

What is adb?

adb (Android Debug Bridge) is one of the command line tools for operating and debugging Android devices in conjunction with a PC.Using the adb command makes it easy to transfer files and install apps.

How to enable adb commands on a Mac

For those developing Android apps on a Mac, we will introduce how to enable adb commands.

$ which adb
adb not found

From this↑, we aim for this↓.

$ which adb
/Users/username/Library/Android/sdk/platform-tools/adb

Steps

Check the Android SDK Location

First, find out where the Android SDK is currently stored on your Mac. Open “Android Studio” > “Preferences” from the top menu, then click “System Settings” > “Android SDK”, and copy the path shown under “Android SDK Location”.

【Mac/Android Studio】adbコマンドとは?使用可能にする方法

Set PATH in zsh

Next, launch the terminal and use Vim to add the path to .zshrc, appending platform-tools to the previously copied Android SDK path.

$ vi .zshrc
$ i // Enter insert mode

// Add the following line
export PATH=$PATH:/Users/your-username/Library/Android/sdk/platform-tools

$ ESC // Exit insert mode

$ :wq // Save and close

$ source ~/.zshrc // Apply the changes

Now the path has been set, and the adb command should be available.

Try confirming that the path was added correctly:

$ which adb
/Users/your-username/Library/Android/sdk/platform-tools/adb

Install an App Using adb Command

By running the adb install command, you can install an app on a connected device.

$ adb install [path to your APK file]

This is useful for testing a release APK on a physical device. Make sure to stop any running emulators and connect only the actual device via USB before executing the command to avoid failures.

For more details, please refer to the following article:

I'm still learning, so if you find any mistakes or improvements, I would really appreciate your feedback.

Thank you for reading.

Search Box

Sponsor

ProFile

ame

Hobbies: reading, learning programming, website creation, blogging

I studied to get an IT pass in order to overcome my dislike of IT, and website creation became my hobby lol. Now I'm running this site completely by myself without using a CMS~

New Article

index