Android adb note

Source: Internet
Author: User

1. query the devices currently connected (physical and virtual)

Shell code

Adb devices

 

Generally, a device with emulator is a virtual device.

2. Map the device port to the PC port

Shell code

Adb-s <devices-name> forward tcp: 8080 tcp: 8080

 

If only one virtual device is connected, the-s devices-name parameter can be omitted (same as above)

4. Installer

Shell code

Adb install <path_to_apk>

 

Start

Shell code

Adb shell am start-W-n <apk-package-name>/<apk-package-activity-name>

 

5. Uninstall the program

Query an app

Shell code

Adb shell

 

Shell code

Ls data/data

 

Uninstall

Shell code

Adb shell pm uninstall-k <apk-package-name>

 

6. Copy files or directories from devices

Shell code

Adb pull <remote> <local>

 

7. Copy files or directories to devices

Shell code

Adb push <local> <remote>

 

8. Disconnect all connected devices

Shell code

Adb kill-server

 

9. Connect all devices

Shell code

Adb start-server

 

10. Get the shell from the device

Shell code

Adb shell

 

11. Send a key message

Shell code

Adb shell sendevent <device> <type> <code> <value>

 

Press the menu key

Shell code

Adb shell sendevent/dev/input/event0 1 1 229 1

 

Release menu

Shell code

Adb shell sendevent/dev/input/event0 1 0 229

 

Key namecode

MENU 229

Back HOME 102

BACK (back button) 158

Calls (CALL button) 231

END (end call button) 107

Related Article

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.