APP (two) adb log analysis

    • Master the common adb commands

    • Learn Android system log files

    • Examples of analysis ANR & crash log

1、ADT、SDK、ADB?

  • ADT (Android development tools) --- Android development tools. Android-related calls and various plug-ins on Eclipse, will have to ADT.
  • SDK (software development kit) ---- software development components. To use all kinds of android platform, like android2.3, etc., it has SDK
  • ADB (Android debug bridge) is a bridge used to connect Android phones and PC side by adb service, at the command line interface to the PC or mobile phone simulator to conduct a comprehensive operation.

 

2, adb common commands

adb -help View Help Manual

adb devices detect the Android device connected to your computer, this is our testing will be frequently used commands.

adb connect / disconnect ip: port number for debugging, mobile phones and computers remotely connect mobile phones in connection with a router by 5555 wif

adb se --- logging in shell (command line of man-machine interface), II Is command can be used to enter the linux command environment, and is equivalent to execute remote commands!

pull the adb <Mobile file path> <native path> (SHOP ohms) to pull information from the phone onto the local computer, ll equivalent open

Push the adb <native file path> <Path Mobile> (plain) from local information to push up the phone

Path (direct path drag) adb install installation packages - in order to obtain the address of your installation packages apk, you can directly drag the apk acquisition cmd window, return to success on the installation was successful!

adb uninstall com.tencent mobileqq -. Application package name

adb shell dumpsys activity | find "mFocusedActivity" - to view the foreground application package name

adb logcat print log information ======= adb logcat -V Time> D: logcat.txt

 

3, logcat log file

  • android system provides a log recording and viewing system debug information, log records from the buffer are a variety of software and some system down, the buffer can be viewed and used by logcat command
  • Use:
    • [adb] logcat [<option>]... [<fiter-spec>].  
  • logcat begins with the following:
  • 1. ------- beginning of xox
  • Developer options, there is an option called "Logging Buffer Size", the default is 256K, the log cycle is written into the ring buffer. Under normal circumstances, when filled, the oldest log will be deleted in order to log the output of the new memory space left a real machine settings, no general simulator

 

4, logcat log file analysis

Output log format is shown below:

It consists of five parts:

    • 1. The time to write the log, as described in the 01-1109: 39: 35.209
    • 2. priority, the Android, the priority from low to high log the following:
      • V- -Verbose (Mark repetitious, some detailed information about the minimum level of development and debugging, used only in development, the release of non-exportable products)
      • D-Debug (debug information for debugging, you can turn off the release of the product, the more common)
      • I- -Info (information, general informational message)
      • W-Warning (warning)
      • E- Error (If you love children) (error, may affect the operation of the error has occurred, such as the output application crash logs)
    • 3. The tag (Tag), indicating filter log log initiator and convenient screening, as described in the ActivityManager. Classes and modules.
    • 4. PID (process ID), above 491
    • The body, the body content of this log

 

5, how to analyze the crash occurred --- a run-crash error

Occurred crash, adb logcat log analysis to obtain:

    • 1, keyword search exception, based on time, locate the package name
    • 2, search fatal, caused by keywords

 

6. What is ANR?

ANR full name Application Not Responding, the application is not responding operation when - - within the period of time when the system can not handle, the system will pop up the right kind of level

ANR dialog

    • To provide users with interactive processing when the main thread is blocked for a long time, improve the user experience
    • Android detection mechanism system itself

 

6.1 How to happen ANR analysis - Application not responding

ANR occurs when the system will record information in three ways:

    • Logcat log
    • Trace file
    • DropBox service

ANR analysis -01

Analyzed by Logcat log:

Log Format

    • ActivityManager: ANR in [ process name ] ([ component name ])
    • ActivityManager: PID: [ application process ID ]
    • ActivityManager: Reason: [ reason prompt ]
    • [Process CPU state]

ps: anr by searching keyword, without specific java error message, go to another method of obtaining logs

 

ANR analysis -02

File analysis: by Trace (dead weight translation): / data / anr /

Dump stack trace information

Dump the process include: the current application process, the parent process, the main process, persistent processes, and CPU usage top few (up to five) process

ps: only record the last - the second occurrence of the information anr

 

ANR analysis -03

data / anr / traces.txt file which can retain information when the last traces occur ANR

    • Abnormality information can be collected over time in the system (including ANR, crash) by dropbox
    • / Data / system / dropbox is the file location specified dropbox

 

 

 

 

 

 

 

 

 

******* Please respect the original, as to reprint, please indicate the source: Reprinted from: https://www.cnblogs.com/shouhu/ , thank you! ! ******* 

Guess you like

Origin www.cnblogs.com/shouhu/p/12495911.html