Analysis of common directives and usage scenarios for ADB tools

Source: Internet
Author: User
Tags memory usage

First, the ADB commonly used commands: (Do not need to enter the device, that is: do not need to execute adb shell)

ADB devices list all connected devices

ADB kill-server close adb

ADB start-server open adb

ADB devices list of identified devices

ADB shell connects to Android terminal, where you can perform a series of operations (Linux-based operations)

ADB reboot phone Restart (provided that the device has entered debug mode)

ADB remount authorization (typically for root version, not authorized for debug version)

ADB logcat Print all log logs

ADB push pushes PC-side files to Android device side

ADB pull pulls the Android device side file "Back" to the PC side; [Device side file path, path delimited by:/] [PC-side path, path delimited by: \]

ADB install-r xxx.apk (reinstall) software reload; Use reinstall instructions if the software was previously installed in the system

ADB install-s xxx.apk installs the software on the SD card instead of the internal storage

ADB uninstall-k xxx.apk (keep) uninstalls software, but retains user data

ADB Root gets root privileges

The ADB Shell am command is in the cmd command line, with explicit instructions to start Activity/broadcast/service, etc.

second, the ADB shell can be executed after the command

ADB Shell screencap–p ... Capture current screen content and save

After ADB shell-to-getevent|grep event0 connected to ADB, check the key response

ADB shell pm ... List permissions, application information in the device

ADB shell Dumpsys activity (information about the Activitymanager system services, including four components of the Android system)

ADB shell Dumpsys meminfo memory usage

ADB shell Dumpsys procstats-hour 3 View process usage in the last 3 hours

Third, Android device install app apk, adb install and adb push comparison

When using YunOS, you encounter incompatibilities, you need to first ensure that the APK file is signed with the specified signature file, and then find other problems.

When using YunOS, the push apk approach:

1. Guaranteed to be root version, need to burn into root version of boot file (corresponding to userdebug version)

2. ADB shell enters file system,/system/app, enter the specified APK file directory, execute: RM-RF arm/(Why do you want to delete it?) )

3. Execution: adb push ... Copy the specified file to the specified directory and change the name

4. ADB reboot

Why is the root version? In a push file, the prerequisite is that the file directory is readable and writable.

For applications in the YunOS system: Install the APK on the first installation to the device using: ADB push mode, and once again, you can select the ADB install to achieve a successful installation.

Other ways to install applications:

ADB install-r ... (apk file for the specified address)

Comparison:

Installing the application using push will overwrite the original apk that existed in the system.

ADB push enables you to specify the installation directory. For example, after implementing "ADB push xxx.apk System/app", xxx.apk is installed in the System/app directory, and the software under this directory is System application.

ADB install the software installed with this command is located in the Data/app directory and is user application.

Four, the Android device in the WiFi environment debugging steps

Sometimes you can not use the USB port debugging logic, switching ideas: Using WiFi debugging Mode for LOGCAT output.

1. Use the data cable to open the debug mode;

2. After the PC-side acquires the device, execute: ADB tcpip 5555 (open 5555 port and occupy)

3. Android device side connection with PC on the same LAN hotspot, and view IP address (example: 10.0.0.81);

4. PC-Side Execution: Ping 10.0.0.81 to see if data is returned;

5. Implementation: ADB connect 10.0.0.81

After the above 5 steps, you can use WiFi for debugging.

The meaning and difference of the slash "/" and the backslash "\" in the system

UNIX uses slashes as the path delimiter, and the UNIX system is the first to be used in Web applications, so all network addresses currently use slashes as delimiters.

Windows uses a slash as a parameter identifier for a DOS command prompt, and in order to avoid confusion, a backslash is used as the path delimiter. Currently, the file browser on the Windows system uses a backslash as the path delimiter.

Conclusion:

1. The browser address bar URL using a slash;

2. Use a backslash on the Windows file browser;

3. The path that appears in the HTML URL () property must use a slash when the path specified is a network path;

4. The path that appears in the normal string, if it represents a Windows file path, the slash or backslash is the same, and if you are representing a network file path, you must use a slash;

Analysis of common directives and usage scenarios for ADB tools

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.