Setting Up Android Studio for Real Device Debugging on macOS
Configuring ADB Environment Variables
To enable the adb command-line tool, add the Android SDK platform-tools directory to the system PATH.
-
Determine the SDK installation path. In Android Studio, navigate to Preferences > Appearance & Behavior > System Settings > Android SDK. The SDK location is displayed at the top of the window.
-
Open a terminal and modify the shell profile configuration. For bash, edit
~/.bash_profile:# Append SDK paths to PATH echo 'export PATH=$PATH:~/Library/Android/sdk/platform-tools' >> ~/.bash_profile echo 'export PATH=$PATH:~/Library/Android/sdk/tools' >> ~/.bash_profile -
Apply the changes by sourcing the profile:
source ~/.bash_profile -
Verify the installation by checking the adb version:
adb version
Adding Device Vendor ID
Register the device's vendor identifier to allow ADB to recognize it.
-
Connect the Android device via USB.
-
List connected USB devices and identify the vendor ID:
system_profiler SPUSBDataType | grep -A 10 "Manufacturer: YourDeviceManufacturer"Look for a line containing
Vendor ID. Example output snippet:Vendor ID: 0x05e4 (Samsung Electronics Co., Ltd.) -
Create or update the ADB USB initialization file:
mkdir -p ~/.android echo "0x05e4" >> ~/.android/adb_usb.ini
Restarting the ADB Daemon
Restart the ADB server to apply the new configuration:
adb kill-server && adb start-server
Enabling USB Debugging
On the Android device, enable developer options (typically by tapping the build number seven times in Settings > About phone). Then, in Developer options, toggle on USB debugging.
Running an Application
In Android Studio, select the physical device from the deployment target menu and execute the run configuration.