Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the adb command in android

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of "how to use the adb command in android". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to use the adb command in android" can help you solve the problem.

What is adb?

The full name of adb is Android Debug Bridge, which plays the role of debugging bridge. It is a command line window that is used to interact with simulators or devices on the computer side.

What's the use of adb?

With the adb tool, we can manage the status of the device or mobile phone simulator. You can also do a lot of mobile phone operations, such as installing software, system upgrades, running shell commands, and so on. In fact, to put it simply, adb is the bridge between the Android phone and the PC, allowing users to fully operate the phone on the computer.

Adb common commands to view the currently connected device adb devices

Multiple device operations, with device number adb-s device number other commands view the top Activityadb shell dumpsys activity | findstr "mFocusedActivity" view log adb logcat / / View all log installation software adb install xxx.apkadb install-r xxx.apk / / overwrite installation, retain data and cache files, reinstall, upgrade adb install-r-t xxx.apkadb shell pm install + apk storage path / / install application (target apk is stored on PC Install with adb install / / Target apk is stored on Android device, installed with pm install)

Uninstall adb uninstall xxx.appadb uninstall-k xxx.app / / retain data uninstall, uninstall app but retain data and cache files

Uninstall WPS

Pushadb push local filename Mobile path

Pulladb pull Mobile path Local File path

Look at all APPadb shell pm list packagesadb shell pm list packages-f / / and show the path

Screenshot adb shell screencap / sdcard/screen.png

Screencap adb shell screenrecord / sdcard/demo.mp4 from computer path copy file to mobile phone adb push crime.apk / sdcard/data/data clear App data adb shell pm clear com.example.packagename outputs some information adb shell input text "insert%stext%shere" / /% s represents space, cannot output Chinese analog touch screen adb shell input tap 1450 / / on the screen Make a click on the coordinate point of adb shell input keyevent + keystroke event / / send keystroke event for example: adb shell input keyevent KEYCODE_HOME simulates pressing the Home key to simulate the sliding screen event adb shell input swipe 100500 1450 / / start with the screen coordinates (100500) and slide to the end of (1450 1450) The whole process takes time 100ms view current memory usage adb shell cat / proc/meminfo view CPU and memory footprint adb shell top view power consumption / / Save to xxx.txtadb shell dumpsys batterystats > xxx.txt view alarm clock adb shell dumpsys alarm file operation adb shell ls [- al] / / details of files and folders adb shell cd / / enter the file directory adb shell cat / / view the file adb Shell du-sh * / / check the file size in the directory Root to determine that # indicates that it is already root $means no root permission to obtain Root permission adb root---su root connection device adb connect + [device ip] 10.0.0.4 adb root---su root 5555 restart device adb reboot to obtain device connection status adb get-state / / device: device connection is normal, offline: connection exception Device does not respond, unknown: no connection device view device background process adb shell ps starts a service adb shell am startservice sends a broadcast adb shell am broadcast starts an Activityadb shell am start + package name / .Activity (Activity to start) / starts an Activity (- s stops the target application first Restart-w wait for the application to complete startup-a launch the default browser to open a web page / / adb shell am start-an android.intent.action.VIEW-d http://testerhome.comadb shell dumpsys activity [] / / View the running activityadb shell dumpsys activity services [] / / View the running service list the package location adb shell pm path+ package name / / list the corresponding package name .apk location list input method adb shell on the device Ime list-s get system version adb shell getprop ro.build.version.release get system version adb shell getprop ro.build.version.sdk get relevant manufacturer information adb shell getprop | grep "model\ | version.sdk\ | manufacturer\ | hardware\ | platform\ | revision\ | serialno\ | product.name\ | brand" get system related information adb shell "cat / system/build.prop | grep" product "get model adb-d shell getprop ro.product.model manufacturer adb-d shell getprop ro .product.brand serial number there are two ways for adb get-serialnoadb shell getprop ro.serialno to obtain MAC address adb shell cat / sys/class/net/wlan0/address to obtain memory information adb shell cat / proc/meminfo storage information adb shell dfadb shell df / data / / internal storage information screen resolution adb shell "dumpsys window | grep mUnrestrictedScreen" multiple devices select an adb-s 192.168.101.37 Visual5555 shell + Operation View process adb shell procrank is closed or Kill the process adb shell kill 366.Clean the application data adb shell pm clear com.baiduCP copy file / / adb shell enter the Android Linux command cp-f system/app/Music/Music.apk / sdcard/Music.apk delete file / / adb shell enter the rm-r / mnt/sdcard/a.mp3 / / delete folder in the Android Linux command need to add the-r parameter cd dir rm * delete all files in dir cat view file cat / sdcard/test.txt to view the specific information of the process / / for example: 1460 is the PIDcat / proc/1460/maps / / View the file structure of the process to be viewed cat / proc/1460/status / / View the status of the process findstr and grep//1) search for the process adb shell ps named com.android.launcher3 under cmd | findstr / I "com.android.launcher3" / / 2) search under shell / / first use adb shell to enter Then use the grep command to filter ps | grep "com.linux.test" about "how to use the adb command in android". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report