Common Debugging commands and tools for Android (1) commands

Source: Internet
Author: User

I. view the memory in command articles:

Use Cases: track the memory usage of processes and check whether memory cannot be recycled. If there is a memory leakage problem in the program, some clues can be seen through the dynamic memory usage.

2. view the available memory allocated by dalvik to each process:

Root @ android:/# getprop

[Dalvik. vm. heapgrowthlimit]: [192 m]: Maximum number of processes that can be allocated to 192 m. If a process exceeds this value, an OOM problem occurs.

[Dalvik. vm. heapmaxfree]: [8 m]

[Dalvik. vm. heapminfree]: [2 m]

[Dalvik. vm. heapsize]: [256 m]: maximum memory allocated to a single virtual machine = 256 m

[Dalvik. vm. heapstartsize]: [8 m]

2. Check the memory usage distribution of the application process:

Root @ android:/# dumpsys meminfo

2. Check the memory occupied by the specified process, such as the phone process.

Root @ android:/# dumpsys meminfo | grep phone

2. Check the memory usage of several specified processes, such as the phone process, phone book process, and information process.

Root @ android:/# dumpsys meminfo | grep-E "phone | mms | contacts"

Memory leakage analysis:

Http://blog.csdn.net/rambomatrix/article/details/17485503

AM debugging:

2. Send broadcast simulation: Run adb shell am broadcast on the command line to send a broadcast. This is often used during debugging.

Parameters following adb shell am broadcast include:
[-A]
[-D ]
[-T ]
[-C [-C ]...]
[-E | -- es ...]
[-- Ez ...]
[-E | -- ei ...]
[-N ]
[-F ] [ ]

Example: adb shell am broadcast-a com. android. test -- es test_string "this is test string" -- ei test_int 100 -- ez test_boolean true description: The blue color is key, the red color is alue, respectively, String type, int type, boolean Type

2 Android AM command line to start the program

Attaching a link is not very common.

Http://blog.csdn.net/sunrock/article/details/5675067

ADB command debugging

Debug version machine:

Adb remount the File System

Adb pull.../Phone.apk g: // extract Phone.apk from the mobile phone and put it on the G drive. If you need to decompile the apk of another machine, you can obtain it like this.

Adb push.../Phone.apk system/app put the modified Phone.apk on the mobile phone. After it is put, the phone process needs to be restarted once.

Root @ android:/ps | grep phone: Find the phone process pid

Root @ android:/kill 1212 kill the phone Process

USER version:

The ROOT root has a high success rate.

Adb shell enters shell

Su get Root permission

Root @ android: // # chmod-R 777 system/grant read and write permissions to the specified directory, and then you can change the files in the directory.

Capture logs

2 Adb logcat

The Android log system maintains multiple cyclic buffers for log messages, and not all messages are sent to the default buffer. To view these additional buffers, use the-B option, the following is a buffer that can be specified:

Radio-view messages contained in the wireless/telephone-related buffer zone

Events-view event-related messages

Main-view master buffer (default buffer)

Common printing methods include:

-V time printing time

-C clears the buffer. You can execute a cleanup operation before printing logs to reduce invalid logs.

-S LOG_TAG: print the log corresponding to the specified log tag

-F file name: Output logs to files

CPU/THREAD View

Check how many threads are running in the current application and how the cpu usage of each thread is. If there is a problem with program writing, some threads are enabled to run in the background but never released, which may seriously affect the program.

Root @ android:/# top-t


You can see the cpu usage of all threads in the email application. This data is useful when analyzing cpu usage problems.



You are welcome to add.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.