Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Setting Up Android Studio for Real Device Debugging on macOS

Tech 1

Configuring ADB Environment Variables

To enable the adb command-line tool, add the Android SDK platform-tools directory to the system PATH.

  1. 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.

  2. 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
    
  3. Apply the changes by sourcing the profile:

    source ~/.bash_profile
    
  4. 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.

  1. Connect the Android device via USB.

  2. 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.)
    
  3. 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.

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.