How to obtain debug logs from Android device
search cancel

How to obtain debug logs from Android device

book

Article ID: 181224

calendar_today

Updated On:

Products

Mobile Management Mobile Security

Issue/Introduction

 

Resolution

Instructions for Obtaining Android Device Debug Logs
  

Mac Computer

  1. On the Android device, enable USB debugging (on Android 4.x, access:  Settings > Developer options > USB Debugging).
      
  2. Connect the Android device to a Mac computer via the USB cable
      
  3. On the connected computer, download the Android SDK
      
  4. Launch the Android SDK Manager (executable named android), and choose to install Android SDK Platform-tools
      
  5. Open a new Terminal window, and change the working directory to:  [path where Android SDK was downloaded or resides]/platform-tools  
     
    Note:  For example, the Android SDK can be uncompressed to any location, e.g.  /opt/android-sdk-macosx/platform-tools)
      
  6. Run:  ./adb kill-server, as a fail-safe measure, then run:  ./adb devices . This will list the available connected devices:  
      
         $ ./adb devices
         * daemon not running. starting it now on port 5037 *
         * daemon started successfully *
         List of devices attached 
         a0123b456cdef78 device
      
    Note:  The Android device must be active and not locked
      
  7. Note the device ID, or copy it to the clipboard, then run:  ./adb logcat -v threadtime [device ID] > /tmp/android-debug.log
      
  8. Perform the actions observed as problematic on the Android device
      
  9. On the Mac computer, in the Terminal window hit control + c , to stop the adb process
      
  10. The debug data will be saved to the following file, in this particular example:  /tmp/android-debug.log . Provide a copy of this debug log to the Support team for review

  

Windows Computer

  1. On the Android device, enable USB debugging (on Android 4.x, access:  Settings > Developer options > USB Debugging)
      
  2. Connect the Android device to a Windows computer via the USB cable
      
  3. On the connected computer, download and install the Android SDK
      
  4. Launch the Android SDK Manager (default after installation completes), and choose to install Android SDK Platform-tools
      
  5. Open a new Command Prompt, and change the working directory to:  [path where Android SDK was installed]/platform-tools  
     
    Note:  Default installation path on a 64-bit machine is:  C:\Program Files (x86)\Android\android-sdk\platform-tools)
      
  6. Run:  adb.exe kill-server, as a fail-safe measure, then run:  adb.exe devices . This will list the available connected devices:  
      
         >adb devices
         * daemon not running. starting it now on port 5037 *
         * daemon started successfully *
         List of devices attached 
         a0123b456cdef78 device
      
    Note:  The Android device must be active and not locked
      
  7. Note the device ID, or copy it to the clipboard, then run:  adb.exe logcat -v threadtime [device ID] > C:\android-debug.log
      
  8. Perform the actions observed as problematic on the Android device
      
  9. On the Windows computer, in the Command Prompt window hit control + c , to stop the adb process
      
  10. The debug data will be saved to the following file, in this particular example:  C:\android-debug.log . Provide a copy of this debug log to the Support team for review

 

*Note* - If the 'Developer Options' menu is not listed in the 'Settings' menu, then it will need to be enabled. Go to Settings > About > Software Information and Click the 'Build number' entry 7 times and the 'Developer Options' should now appear in the 'Settings' menu towards the bottom of the screen.

*Note* - Drivers specific to the Android device bring used for log collection will need to be installed on the host machine in order for the ADB to recognize the it. The device's drivers can be collected from its manufacturer's website.

 

Refer to the following links to download and learn how to debug with Android Studio:

1. https://developer.android.com/sdk/installing/studio.html

2. https://developer.android.com/sdk/installing/studio-debug.html#runDebug

Additional Information

DESCRIPTION :

Keywords for searching purposes include the following:

gather, logs, Android, debug