{"id":70131,"date":"2026-02-01T15:35:58","date_gmt":"2026-02-01T07:35:58","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/70131.html"},"modified":"2026-02-01T15:35:58","modified_gmt":"2026-02-01T07:35:58","slug":"android-%e6%97%a5%e5%b8%b8%e5%bc%80%e5%8f%91adb%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4%e9%99%84%e6%a1%a3","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/70131.html","title":{"rendered":"Android \u65e5\u5e38\u5f00\u53d1Adb\u5e38\u7528\u547d\u4ee4\u9644\u6863"},"content":{"rendered":"<h2>\u4ecb\u7ecd<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5728\u505aAndroid\u5f00\u53d1\u7684\u65f6\u5019&#xff0c;\u6211\u4eec\u7ecf\u5e38\u4f1a\u7528\u9700\u8981\u7ba1\u7406\u8bbe\u5907&#xff0c;\u6a21\u62df\u8bbe\u5907&#xff0c;\u6700\u597d\u7684\u4f34\u4fa3\u5c31\u662fADB\u547d\u4ee4<\/p>\n<h3>\u5e38\u89c1\u7684Adb\u547d\u4ee4<\/h3>\n<h3>\u4e00\u3001ADB \u57fa\u7840\u547d\u4ee4<\/h3>\n<h4>1. \u8bbe\u5907\u8fde\u63a5\u7ba1\u7406<\/h4>\n<p># \u67e5\u770b\u5df2\u8fde\u63a5\u7684\u8bbe\u5907<br \/>\nadb devices<\/p>\n<p># \u67e5\u770b\u8bbe\u5907\u5e8f\u5217\u53f7<br \/>\nadb get-serialno<\/p>\n<p># \u67e5\u770b\u8bbe\u5907\u72b6\u6001<br \/>\nadb get-state<\/p>\n<p># \u67e5\u770b\u8bbe\u5907 IP \u5730\u5740<br \/>\nadb shell ifconfig \u6216 adb shell ip addr show<\/p>\n<p># \u65e0\u7ebf\u8fde\u63a5\u8bbe\u5907&#xff08;\u9700\u5148\u901a\u8fc7USB\u8fde\u63a5,\u9700\u8981\u518d\u624b\u673a\u5f00\u53d1\u8005\u5f00\u542f\u65e0\u7ebf\u8c03\u8bd5&#xff09;<br \/>\nadb tcpip 5555<br \/>\nadb connect 192.168.1.100:5555<\/p>\n<p># \u65ad\u5f00\u65e0\u7ebf\u8fde\u63a5<br \/>\nadb disconnect 192.168.1.100:5555<\/p>\n<p># \u91cd\u65b0\u8fde\u63a5\u5230 USB<br \/>\nadb usb<\/p>\n<h4>2. \u5e94\u7528\u7ba1\u7406<\/h4>\n<h5>2.1\u5b89\u88c5\u5e94\u7528<\/h5>\n<p># \u5b89\u88c5 APK<br \/>\nadb install app.apk<\/p>\n<p># \u5b89\u88c5\u5e76\u66ff\u6362\u73b0\u6709\u5e94\u7528<br \/>\nadb install -r app.apk<\/p>\n<p># \u5141\u8bb8\u6d4b\u8bd5 APK<br \/>\nadb install -t app.apk<\/p>\n<p># \u5b89\u88c5\u5230\u6307\u5b9a\u4f4d\u7f6e<br \/>\nadb install -s app.apk  # \u5b89\u88c5\u5230 SD \u5361<\/p>\n<p># \u591a\u8bbe\u5907\u65f6\u6307\u5b9a\u8bbe\u5907\u5b89\u88c5<br \/>\nadb -s emulator-5554 install app.apk<\/p>\n<h5>2.2\u5378\u8f7d\u5e94\u7528<\/h5>\n<p># \u5378\u8f7d\u5e94\u7528<br \/>\nadb uninstall com.example.app<\/p>\n<p># \u5378\u8f7d\u4f46\u4fdd\u7559\u6570\u636e<br \/>\nadb uninstall -k com.example.app<\/p>\n<h5>2.3\u5e94\u7528\u4fe1\u606f<\/h5>\n<p># \u5217\u51fa\u6240\u6709\u5e94\u7528<br \/>\nadb shell pm list packages<\/p>\n<p># \u5217\u51fa\u7cfb\u7edf\u5e94\u7528<br \/>\nadb shell pm list packages -s<\/p>\n<p># \u5217\u51fa\u7b2c\u4e09\u65b9\u5e94\u7528<br \/>\nadb shell pm list packages -3<\/p>\n<p># \u67e5\u770b\u5e94\u7528\u5b89\u88c5\u8def\u5f84<br \/>\nadb shell pm path com.example.app<\/p>\n<p># \u6e05\u9664\u5e94\u7528\u6570\u636e<br \/>\nadb shell pm clear com.example.app<\/p>\n<p># \u67e5\u770b\u5e94\u7528\u8be6\u7ec6\u4fe1\u606f<br \/>\nadb shell dumpsys package com.example.app<\/p>\n<h4>3. \u6587\u4ef6\u64cd\u4f5c<\/h4>\n<h5>3.1\u590d\u5236\u6587\u4ef6<\/h5>\n<p># \u4ece\u8bbe\u5907\u590d\u5236\u5230\u7535\u8111<br \/>\nadb pull \/sdcard\/file.txt .\/local\/path\/<\/p>\n<p># \u4ece\u7535\u8111\u590d\u5236\u5230\u8bbe\u5907<br \/>\nadb push .\/local\/file.txt \/sdcard\/<\/p>\n<p># \u590d\u5236\u6574\u4e2a\u76ee\u5f55<br \/>\nadb pull \/sdcard\/folder\/ .\/<br \/>\nadb push .\/folder\/ \/sdcard\/<\/p>\n<h5>3.2\u6587\u4ef6\u7ba1\u7406<\/h5>\n<p># \u67e5\u770b\u6587\u4ef6\u5217\u8868<br \/>\nadb shell ls \/sdcard\/<br \/>\nadb shell ls -la \/sdcard\/<\/p>\n<p># \u521b\u5efa\u76ee\u5f55<br \/>\nadb shell mkdir \/sdcard\/new_folder<\/p>\n<p># \u5220\u9664\u6587\u4ef6<br \/>\nadb shell rm \/sdcard\/file.txt<\/p>\n<p># \u5220\u9664\u76ee\u5f55<br \/>\nadb shell rm -r \/sdcard\/folder\/<\/p>\n<p># \u91cd\u547d\u540d\/\u79fb\u52a8\u6587\u4ef6<br \/>\nadb shell mv \/sdcard\/old.txt \/sdcard\/new.txt<\/p>\n<h4>4. \u65e5\u5fd7\u64cd\u4f5c<\/h4>\n<h5>4.1\u57fa\u672c\u65e5\u5fd7\u67e5\u770b<\/h5>\n<p># \u67e5\u770b\u5b9e\u65f6\u65e5\u5fd7<br \/>\nadb logcat<\/p>\n<p># \u6e05\u7a7a\u65e5\u5fd7<br \/>\nadb logcat -c<\/p>\n<p># \u67e5\u770b\u5e26\u65f6\u95f4\u7684\u65e5\u5fd7<br \/>\nadb logcat -v time<\/p>\n<p># \u67e5\u770b\u7279\u5b9a\u6807\u7b7e\u7684\u65e5\u5fd7<br \/>\nadb logcat -s TAG_NAME<\/p>\n<p># \u5c06\u65e5\u5fd7\u4fdd\u5b58\u5230\u6587\u4ef6<br \/>\nadb logcat &gt; log.txt<\/p>\n<h5>4.2\u9ad8\u7ea7\u65e5\u5fd7\u8fc7\u6ee4<\/h5>\n<p># \u6309\u4f18\u5148\u7ea7\u8fc7\u6ee4<br \/>\nadb logcat *:W  # \u53ea\u663e\u793a Warning \u53ca\u4ee5\u4e0a\u7ea7\u522b<\/p>\n<p># \u591a\u6761\u4ef6\u8fc7\u6ee4<br \/>\nadb logcat -s TAG1:TAG2 *:S<\/p>\n<p># \u663e\u793a\u7279\u5b9a\u8fdb\u7a0b\u65e5\u5fd7<br \/>\nadb logcat &#8211;pid&#061;PID<\/p>\n<p># \u6309\u65f6\u95f4\u67e5\u770b\u65e5\u5fd7<br \/>\nadb logcat -t &#039;01-26 14:00:00.000&#039;<\/p>\n<p>4.3Bug\u62a5\u544a<\/p>\n<p># \u751f\u6210\u5b8c\u6574 bugreport<br \/>\nadb bugreport<\/p>\n<p># \u4fdd\u5b58\u5230\u6587\u4ef6<br \/>\nadb bugreport &gt; bugreport.zip<\/p>\n<h4>5. \u8bbe\u5907\u4fe1\u606f<\/h4>\n<h5>5.1\u7cfb\u7edf\u4fe1\u606f<\/h5>\n<p># \u67e5\u770b\u8bbe\u5907\u578b\u53f7<br \/>\nadb shell getprop ro.product.model<\/p>\n<p># \u67e5\u770b Android \u7248\u672c<br \/>\nadb shell getprop ro.build.version.release<\/p>\n<p># \u67e5\u770b\u7cfb\u7edf\u6784\u5efa\u4fe1\u606f<br \/>\nadb shell getprop ro.build.fingerprint<\/p>\n<p># \u67e5\u770b\u6240\u6709\u5c5e\u6027<br \/>\nadb shell getprop<\/p>\n<p># \u67e5\u770b CPU \u4fe1\u606f<br \/>\nadb shell cat \/proc\/cpuinfo<\/p>\n<p># \u67e5\u770b\u5185\u5b58\u4fe1\u606f<br \/>\nadb shell cat \/proc\/meminfo<br \/>\nadb shell dumpsys meminfo<\/p>\n<h5>5.2\u7535\u6c60\u4fe1\u606f<\/h5>\n<p># \u67e5\u770b\u7535\u6c60\u72b6\u6001<br \/>\nadb shell dumpsys battery<\/p>\n<p># \u8bbe\u7f6e\u7535\u6c60\u72b6\u6001&#xff08;\u6a21\u62df&#xff09;<br \/>\nadb shell dumpsys battery set level 50<br \/>\nadb shell dumpsys battery set status 2  # 2&#061;\u5145\u7535\u4e2d<\/p>\n<p># \u91cd\u7f6e\u7535\u6c60\u72b6\u6001<br \/>\nadb shell dumpsys battery reset<\/p>\n<h5>5.3\u5c4f\u5e55\u4fe1\u606f<\/h5>\n<p># \u83b7\u53d6\u5c4f\u5e55\u5206\u8fa8\u7387<br \/>\nadb shell wm size<\/p>\n<p># \u83b7\u53d6\u5c4f\u5e55\u5bc6\u5ea6<br \/>\nadb shell wm density<\/p>\n<p># \u4fee\u6539\u5c4f\u5e55\u5206\u8fa8\u7387&#xff08;\u4e34\u65f6&#xff09;<br \/>\nadb shell wm size 1080&#215;1920<\/p>\n<p># \u4fee\u6539\u5c4f\u5e55\u5bc6\u5ea6<br \/>\nadb shell wm density 320<\/p>\n<p># \u6062\u590d\u9ed8\u8ba4\u8bbe\u7f6e<br \/>\nadb shell wm size reset<br \/>\nadb shell wm density reset<\/p>\n<h4>6. \u8f93\u5165\u64cd\u4f5c<\/h4>\n<h5>6.1\u6a21\u62df\u6309\u952e\u4e8b\u4ef6<\/h5>\n<p># \u5e38\u7528\u6309\u952e\u7801<br \/>\nadb shell input keyevent 3    # HOME<br \/>\nadb shell input keyevent 4    # BACK<br \/>\nadb shell input keyevent 24   # \u97f3\u91cf&#043;<br \/>\nadb shell input keyevent 25   # \u97f3\u91cf-<br \/>\nadb shell input keyevent 26   # \u7535\u6e90\u952e<br \/>\nadb shell input keyevent 82   # \u83dc\u5355\u952e<br \/>\nadb shell input keyevent 220  # \u5c4f\u5e55\u4eae\u5ea6&#043;<br \/>\nadb shell input keyevent 221  # \u5c4f\u5e55\u4eae\u5ea6-<\/p>\n<p># \u5a92\u4f53\u63a7\u5236<br \/>\nadb shell input keyevent 85    # \u64ad\u653e\/\u6682\u505c<br \/>\nadb shell input keyevent 86    # \u505c\u6b62<br \/>\nadb shell input keyevent 87    # \u4e0b\u4e00\u66f2<br \/>\nadb shell input keyevent 88    # \u4e0a\u4e00\u66f2<\/p>\n<h5>6.2\u89e6\u6478\u548c\u6ed1\u52a8<\/h5>\n<p># \u70b9\u51fb\u5c4f\u5e55\u5750\u6807<br \/>\nadb shell input tap 500 1000<\/p>\n<p># \u6ed1\u52a8\u64cd\u4f5c<br \/>\nadb shell input swipe 300 1000 300 500  # \u5411\u4e0a\u6ed1\u52a8<br \/>\nadb shell input swipe 500 500 100 500   # \u5411\u5de6\u6ed1\u52a8<\/p>\n<p># \u957f\u6309<br \/>\nadb shell input swipe 500 500 500 500 1000<\/p>\n<p># \u6587\u672c\u8f93\u5165<br \/>\nadb shell input text &#034;Hello World&#034;<\/p>\n<h4>7. \u622a\u56fe\u548c\u5f55\u5c4f<\/h4>\n<h5>7.1\u622a\u56fe<\/h5>\n<p># \u622a\u56fe\u4fdd\u5b58\u5230\u8bbe\u5907<br \/>\nadb shell screencap \/sdcard\/screenshot.png<\/p>\n<p># \u622a\u56fe\u5e76\u76f4\u63a5\u4fdd\u5b58\u5230\u7535\u8111<br \/>\nadb exec-out screencap -p &gt; screenshot.png<\/p>\n<p># \u81ea\u52a8\u5316\u622a\u56fe<br \/>\nadb shell screencap \/sdcard\/screen.png &amp;&amp; adb pull \/sdcard\/screen.png<\/p>\n<h5>7.2\u5f55\u5c4f<\/h5>\n<p># \u5f00\u59cb\u5f55\u5c4f<br \/>\nadb shell screenrecord \/sdcard\/demo.mp4<\/p>\n<p># \u8bbe\u7f6e\u5f55\u5236\u65f6\u95f4&#xff08;\u79d2&#xff09;<br \/>\nadb shell screenrecord &#8211;time-limit 30 \/sdcard\/demo.mp4<\/p>\n<p># \u8bbe\u7f6e\u5206\u8fa8\u7387<br \/>\nadb shell screenrecord &#8211;size 1280&#215;720 \/sdcard\/demo.mp4<\/p>\n<p># \u8bbe\u7f6e\u6bd4\u7279\u7387<br \/>\nadb shell screenrecord &#8211;bit-rate 4000000 \/sdcard\/demo.mp4<\/p>\n<h4>8. \u6027\u80fd\u76d1\u63a7<\/h4>\n<h5>8.1CPU \u4f7f\u7528\u60c5\u51b5<\/h5>\n<p># \u67e5\u770b CPU \u4f7f\u7528\u7387<br \/>\nadb shell top -n 1<\/p>\n<p># \u67e5\u770b\u6307\u5b9a\u8fdb\u7a0b<br \/>\nadb shell top -p PID<\/p>\n<p># \u6301\u7eed\u76d1\u63a7<br \/>\nadb shell top -d 1<\/p>\n<h5>8.2\u5185\u5b58\u76d1\u63a7<\/h5>\n<p># \u67e5\u770b\u5185\u5b58\u4f7f\u7528\u60c5\u51b5<br \/>\nadb shell dumpsys meminfo<\/p>\n<p># \u67e5\u770b\u6307\u5b9a\u5e94\u7528\u5185\u5b58<br \/>\nadb shell dumpsys meminfo com.example.app<\/p>\n<h5>8.3\u7f51\u7edc\u72b6\u6001<\/h5>\n<p># \u67e5\u770b\u7f51\u7edc\u8fde\u63a5<br \/>\nadb shell netstat<\/p>\n<p># \u67e5\u770b\u7f51\u7edc\u901f\u5ea6<br \/>\nadb shell dumpsys netstats<\/p>\n<h5>8.4\u7535\u6c60\u6027\u80fd<\/h5>\n<p># \u67e5\u770b\u7535\u6c60\u72b6\u6001<br \/>\nadb shell dumpsys batterystats<\/p>\n<p># \u751f\u6210\u7535\u6c60\u62a5\u544a<br \/>\nadb shell dumpsys batterystats &#8211;reset<br \/>\nadb shell dumpsys batterystats &#8211;checkin<\/p>\n<h4>9. \u7f51\u7edc\u76f8\u5173<\/h4>\n<h5>9.1\u7f51\u7edc\u8c03\u8bd5<\/h5>\n<p># \u67e5\u770b\u7f51\u7edc\u72b6\u6001<br \/>\nadb shell ping www.google.com<\/p>\n<p># \u67e5\u770b\u7f51\u7edc\u4fe1\u606f<br \/>\nadb shell ifconfig<br \/>\nadb shell ip addr show<\/p>\n<p># \u67e5\u770b\u8def\u7531\u8868<br \/>\nadb shell netstat -rn<br \/>\nadb shell ip route show<\/p>\n<h5>9.2\u7aef\u53e3\u8f6c\u53d1<\/h5>\n<p># \u7aef\u53e3\u8f6c\u53d1<br \/>\nadb forward tcp:8080 tcp:8080<\/p>\n<p># \u53cd\u5411\u7aef\u53e3\u8f6c\u53d1<br \/>\nadb reverse tcp:8080 tcp:8080<\/p>\n<p># \u67e5\u770b\u6240\u6709\u8f6c\u53d1<br \/>\nadb forward &#8211;list<\/p>\n<h5>9.3\u7f51\u7edc\u9650\u901f&#xff08;\u6a21\u62df\u5f31\u7f51&#xff09;<\/h5>\n<p># \u542f\u7528\u7f51\u7edc\u9650\u901f<br \/>\nadb shell svc data disable  # \u7981\u7528\u79fb\u52a8\u6570\u636e<br \/>\nadb shell svc wifi disable  # \u7981\u7528 WiFi<\/p>\n<p># \u8bbe\u7f6e\u7f51\u7edc\u5ef6\u8fdf<br \/>\nadb shell tc qdisc add dev wlan0 root netem delay 100ms<\/p>\n<p># \u8bbe\u7f6e\u4e22\u5305\u7387<br \/>\nadb shell tc qdisc add dev wlan0 root netem loss 10%<\/p>\n<h4>10. \u8fdb\u7a0b\u7ba1\u7406<\/h4>\n<h5>10.1\u67e5\u770b\u8fdb\u7a0b<\/h5>\n<p># \u67e5\u770b\u6240\u6709\u8fdb\u7a0b<br \/>\nadb shell ps<\/p>\n<p># \u67e5\u770b\u7279\u5b9a\u5e94\u7528\u8fdb\u7a0b<br \/>\nadb shell ps | grep com.example<\/p>\n<p># \u67e5\u770b\u8fdb\u7a0b\u6811<br \/>\nadb shell ps -A<\/p>\n<h5>10.2\u8fdb\u7a0b\u63a7\u5236<\/h5>\n<p># \u6740\u6b7b\u8fdb\u7a0b<br \/>\nadb shell am kill com.example.app<br \/>\nadb shell kill PID<\/p>\n<p># \u5f3a\u5236\u505c\u6b62\u5e94\u7528<br \/>\nadb shell am force-stop com.example.app<\/p>\n<h4>11. Activity \u548c Service \u7ba1\u7406<\/h4>\n<h5>11.1Activity \u64cd\u4f5c<\/h5>\n<p># \u542f\u52a8 Activity<br \/>\nadb shell am start -n com.example\/.MainActivity<\/p>\n<p># \u542f\u52a8\u5e26\u53c2\u6570\u7684 Activity<br \/>\nadb shell am start -n com.example\/.MainActivity -e key value<\/p>\n<p># \u542f\u52a8\u6d4f\u89c8\u5668\u6253\u5f00\u7f51\u5740<br \/>\nadb shell am start -a android.intent.action.VIEW -d &#034;https:\/\/www.example.com&#034;<\/p>\n<p># \u67e5\u770b\u5f53\u524d Activity<br \/>\nadb shell dumpsys activity activities | grep mResumedActivity<\/p>\n<h5>11.2Service \u64cd\u4f5c<\/h5>\n<p># \u542f\u52a8 Service<br \/>\nadb shell am startservice com.example\/.MyService<\/p>\n<p># \u505c\u6b62 Service<br \/>\nadb shell am stopservice com.example\/.MyService<\/p>\n<h4>12. \u5e7f\u64ad\u53d1\u9001<\/h4>\n<p># \u53d1\u9001\u5e7f\u64ad<br \/>\nadb shell am broadcast -a android.intent.action.BOOT_COMPLETED<\/p>\n<p># \u53d1\u9001\u5e26\u53c2\u6570\u7684\u5e7f\u64ad<br \/>\nadb shell am broadcast -a com.example.MY_ACTION -e key value<\/p>\n<p># \u53d1\u9001\u7ed9\u7279\u5b9a\u5e94\u7528<br \/>\nadb shell am broadcast -a android.intent.action.BOOT_COMPLETED -n com.example\/.MyReceiver<\/p>\n<h4>13. \u6743\u9650\u7ba1\u7406<\/h4>\n<p># \u67e5\u770b\u5e94\u7528\u6743\u9650<br \/>\nadb shell pm list permissions -d -g<\/p>\n<p># \u6388\u4e88\u6743\u9650<br \/>\nadb shell pm grant com.example.app android.permission.CAMERA<\/p>\n<p># \u64a4\u9500\u6743\u9650<br \/>\nadb shell pm revoke com.example.app android.permission.CAMERA<\/p>\n<h4>14. \u8f93\u5165\u6cd5\u7ba1\u7406<\/h4>\n<p># \u5217\u51fa\u6240\u6709\u8f93\u5165\u6cd5<br \/>\nadb shell ime list -a<\/p>\n<p># \u8bbe\u7f6e\u9ed8\u8ba4\u8f93\u5165\u6cd5<br \/>\nadb shell settings put secure default_input_method com.example.ime\/.ImeService<\/p>\n<p># \u542f\u7528\/\u7981\u7528\u8f93\u5165\u6cd5<br \/>\nadb shell ime enable com.example.ime\/.ImeService<br \/>\nadb shell ime disable com.example.ime\/.ImeService<\/p>\n<h4>15. \u6a21\u62df\u5668\u63a7\u5236<\/h4>\n<p># \u6a21\u62df\u6765\u7535<br \/>\nadb emu gsm call 1234567890<\/p>\n<p># \u6302\u65ad\u7535\u8bdd<br \/>\nadb emu gsm cancel 1234567890<\/p>\n<p># \u6a21\u62df\u77ed\u4fe1<br \/>\nadb emu sms send 1234567890 &#034;Hello&#034;<\/p>\n<p># \u6a21\u62df GPS \u4f4d\u7f6e<br \/>\nadb emu geo fix 121.5 25.0<\/p>\n<p># \u6a21\u62df\u7535\u91cf\u53d8\u5316<br \/>\nadb emu power capacity 50<br \/>\nadb emu power ac off  # \u65ad\u5f00\u5145\u7535<\/p>\n<h4>16. \u9ad8\u7ea7\u8c03\u8bd5\u529f\u80fd<\/h4>\n<h5>16.1\u65e0\u7ebf\u8c03\u8bd5&#xff08;Android 11&#043;&#xff09;<\/h5>\n<p># \u914d\u5bf9\u8bbe\u5907<br \/>\nadb pair 192.168.1.100:12345<br \/>\n# \u8f93\u5165\u914d\u5bf9\u7801<\/p>\n<p># \u8fde\u63a5\u5df2\u914d\u5bf9\u8bbe\u5907<br \/>\nadb connect 192.168.1.100:12345<\/p>\n<h5>16.2\u5206\u5c4f\u6a21\u5f0f<\/h5>\n<p># \u8fdb\u5165\u5206\u5c4f\u6a21\u5f0f<br \/>\nadb shell am start -n com.example\/.MainActivity &#8211;windowingMode 2<\/p>\n<h5>16.3\u5c4f\u5e55\u65cb\u8f6c<\/h5>\n<p># \u9501\u5b9a\u65cb\u8f6c<br \/>\nadb shell settings put system accelerometer_rotation 0<\/p>\n<p># \u8bbe\u7f6e\u65b9\u5411<br \/>\nadb shell settings put system user_rotation 0  # 0&#061;\u7ad6\u5c4f&#xff0c;1&#061;\u6a2a\u5c4f<\/p>\n<p># \u89e3\u9501\u81ea\u52a8\u65cb\u8f6c<br \/>\nadb shell settings put system accelerometer_rotation 1<\/p>\n<h4>17. \u5b9e\u7528\u811a\u672c\u793a\u4f8b<\/h4>\n<h5>17.1\u6279\u91cf\u5b89\u88c5 APK<\/h5>\n<p>#!\/bin\/bash<br \/>\nfor apk in *.apk; do<br \/>\n    echo &#034;Installing $apk&#8230;&#034;<br \/>\n    adb install &#034;$apk&#034;<br \/>\ndone<\/p>\n<h5>17.2\u81ea\u52a8\u5316\u6d4b\u8bd5\u811a\u672c<\/h5>\n<p>#!\/bin\/bash<br \/>\n# \u6e05\u7406\u65e5\u5fd7<br \/>\nadb logcat -c<\/p>\n<p># \u542f\u52a8\u5e94\u7528<br \/>\nadb shell am start -n com.example\/.MainActivity<\/p>\n<p># \u7b49\u5f85\u52a0\u8f7d<br \/>\nsleep 2<\/p>\n<p># \u6267\u884c\u64cd\u4f5c<br \/>\nadb shell input tap 100 200<br \/>\nadb shell input text &#034;test&#034;<br \/>\nadb shell input keyevent 66  # Enter<\/p>\n<p># \u622a\u56fe<br \/>\nadb exec-out screencap -p &gt; test_result.png<\/p>\n<p># \u83b7\u53d6\u65e5\u5fd7<br \/>\nadb logcat -d &gt; test_log.txt<\/p>\n<h5>17.3\u8bbe\u5907\u76d1\u63a7\u811a\u672c<\/h5>\n<p>#!\/bin\/bash<br \/>\nwhile true; do<br \/>\n    echo &#034;&#061;&#061;&#061; $(date) &#061;&#061;&#061;&#034;<br \/>\n    echo &#034;CPU Usage:&#034;<br \/>\n    adb shell top -n 1 | head -20<br \/>\n    echo &#034;&#034;<br \/>\n    echo &#034;Memory Usage:&#034;<br \/>\n    adb shell dumpsys meminfo | head -30<br \/>\n    echo &#034;&#034;<br \/>\n    echo &#034;Battery:&#034;<br \/>\n    adb shell dumpsys battery<br \/>\n    echo &#034;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#061;&#034;<br \/>\n    sleep 5<br \/>\ndone<\/p>\n<h3>\u4e09\u3001\u4f7f\u7528\u6280\u5de7\u548c\u63d0\u793a<\/h3>\n<li>\n<h4>\u591a\u8bbe\u5907\u64cd\u4f5c<\/h4>\n<p># \u6307\u5b9a\u8bbe\u5907\u6267\u884c\u547d\u4ee4<br \/>\nadb -s device_serial_number command<\/p>\n<p># \u540c\u65f6\u5411\u6240\u6709\u8bbe\u5907\u53d1\u9001\u547d\u4ee4<br \/>\nadb devices | tail -n &#043;2 | cut -sf 1 | xargs -I {} adb -s {} command\n<\/li>\n<li>\n<h4>\u547d\u4ee4\u7ec4\u5408&#xff1a;<br \/>\n\u00a0<\/h4>\n<p># \u8fde\u7eed\u6267\u884c\u591a\u4e2a\u547d\u4ee4<br \/>\nadb shell &#034;cmd1 &amp;&amp; cmd2 &amp;&amp; cmd3&#034;<\/p>\n<p># \u7ba1\u9053\u64cd\u4f5c<br \/>\nadb shell ps | grep com.example<\/p>\n<\/li>\n<li>\n<h4>\u63d0\u9ad8\u6548\u7387&#xff1a;<br \/>\n\u00a0<\/h4>\n<p># \u521b\u5efa\u522b\u540d<br \/>\nalias adbs&#061;&#039;adb shell&#039;<br \/>\nalias adbll&#061;&#039;adb logcat&#039;<\/p>\n<p># \u4f7f\u7528\u811a\u672c\u81ea\u52a8\u5316\u91cd\u590d\u4efb\u52a1<\/p>\n<h3>\u56db\u3001\u5e38\u89c1\u95ee\u9898\u89e3\u51b3<\/h3>\n<h4>\u8bbe\u5907\u672a\u8bc6\u522b&#xff1a;<\/h4>\n<p># \u91cd\u542f adb \u670d\u52a1<br \/>\nadb kill-server<br \/>\nadb start-server<\/p>\n<p># \u67e5\u770b USB \u8fde\u63a5<br \/>\nlsusb  # Linux\/Mac<\/p>\n<h4>\u6743\u9650\u4e0d\u8db3&#xff1a;<\/h4>\n<p># \u83b7\u53d6 root \u6743\u9650&#xff08;\u9700\u8981\u5df2 root \u7684\u8bbe\u5907&#xff09;<br \/>\nadb root<\/p>\n<p># \u91cd\u65b0\u6302\u8f7d\u7cfb\u7edf\u5206\u533a\u4e3a\u53ef\u5199<br \/>\nadb remount<\/p>\n<h4>\u547d\u4ee4\u65e0\u54cd\u5e94&#xff1a;<\/h4>\n<p># \u91cd\u542f adbd<br \/>\nadb usb<br \/>\nadb tcpip 5555<br \/>\n#\u91cd\u542f<br \/>\nadb reboot <\/p>\n<\/li><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ecb\u7ecd\u5728\u505aAndroid\u5f00\u53d1\u7684\u65f6\u5019&#xff0c;\u6211\u4eec\u7ecf\u5e38\u4f1a\u7528\u9700\u8981\u7ba1\u7406\u8bbe\u5907&#xff0c;\u6a21\u62df\u8bbe\u5907&#xff0c;\u6700\u597d\u7684\u4f34\u4fa3\u5c31\u662fADB\u547d\u4ee4\u5e38\u89c1\u7684Adb\u547d\u4ee4\u4e00\u3001ADB \u57fa\u7840\u547d\u4ee41. \u8bbe\u5907\u8fde\u63a5\u7ba1\u7406# \u67e5\u770b\u5df2\u8fde\u63a5\u7684\u8bbe\u5907<br \/>\nadb devices# \u67e5\u770b\u8bbe\u5907\u5e8f\u5217\u53f7<br \/>\nadb get-serialno# \u67e5\u770b\u8bbe\u5907\u72b6\u6001<br \/>\nadb get-state# \u67e5\u770b\u8bbe\u5907 IP \u5730\u5740<br \/>\nadb shell ifconfig \u6216 adb shell ip addr show# \u65e0\u7ebf\u8fde\u63a5\u8bbe\u5907&#xff08;\u9700\u5148\u901a<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[116,84],"topic":[],"class_list":["post-70131","post","type-post","status-publish","format-standard","hentry","category-server","tag-adb","tag-android"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Android \u65e5\u5e38\u5f00\u53d1Adb\u5e38\u7528\u547d\u4ee4\u9644\u6863 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/70131.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android \u65e5\u5e38\u5f00\u53d1Adb\u5e38\u7528\u547d\u4ee4\u9644\u6863 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4ecb\u7ecd\u5728\u505aAndroid\u5f00\u53d1\u7684\u65f6\u5019&#xff0c;\u6211\u4eec\u7ecf\u5e38\u4f1a\u7528\u9700\u8981\u7ba1\u7406\u8bbe\u5907&#xff0c;\u6a21\u62df\u8bbe\u5907&#xff0c;\u6700\u597d\u7684\u4f34\u4fa3\u5c31\u662fADB\u547d\u4ee4\u5e38\u89c1\u7684Adb\u547d\u4ee4\u4e00\u3001ADB \u57fa\u7840\u547d\u4ee41. \u8bbe\u5907\u8fde\u63a5\u7ba1\u7406# \u67e5\u770b\u5df2\u8fde\u63a5\u7684\u8bbe\u5907 adb devices# \u67e5\u770b\u8bbe\u5907\u5e8f\u5217\u53f7 adb get-serialno# \u67e5\u770b\u8bbe\u5907\u72b6\u6001 adb get-state# \u67e5\u770b\u8bbe\u5907 IP \u5730\u5740 adb shell ifconfig \u6216 adb shell ip addr show# \u65e0\u7ebf\u8fde\u63a5\u8bbe\u5907&#xff08;\u9700\u5148\u901a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/70131.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-01T07:35:58+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/70131.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/70131.html\",\"name\":\"Android \u65e5\u5e38\u5f00\u53d1Adb\u5e38\u7528\u547d\u4ee4\u9644\u6863 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-01T07:35:58+00:00\",\"dateModified\":\"2026-02-01T07:35:58+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/70131.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/70131.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/70131.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android \u65e5\u5e38\u5f00\u53d1Adb\u5e38\u7528\u547d\u4ee4\u9644\u6863\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android \u65e5\u5e38\u5f00\u53d1Adb\u5e38\u7528\u547d\u4ee4\u9644\u6863 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/70131.html","og_locale":"zh_CN","og_type":"article","og_title":"Android \u65e5\u5e38\u5f00\u53d1Adb\u5e38\u7528\u547d\u4ee4\u9644\u6863 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4ecb\u7ecd\u5728\u505aAndroid\u5f00\u53d1\u7684\u65f6\u5019&#xff0c;\u6211\u4eec\u7ecf\u5e38\u4f1a\u7528\u9700\u8981\u7ba1\u7406\u8bbe\u5907&#xff0c;\u6a21\u62df\u8bbe\u5907&#xff0c;\u6700\u597d\u7684\u4f34\u4fa3\u5c31\u662fADB\u547d\u4ee4\u5e38\u89c1\u7684Adb\u547d\u4ee4\u4e00\u3001ADB \u57fa\u7840\u547d\u4ee41. \u8bbe\u5907\u8fde\u63a5\u7ba1\u7406# \u67e5\u770b\u5df2\u8fde\u63a5\u7684\u8bbe\u5907 adb devices# \u67e5\u770b\u8bbe\u5907\u5e8f\u5217\u53f7 adb get-serialno# \u67e5\u770b\u8bbe\u5907\u72b6\u6001 adb get-state# \u67e5\u770b\u8bbe\u5907 IP \u5730\u5740 adb shell ifconfig \u6216 adb shell ip addr show# \u65e0\u7ebf\u8fde\u63a5\u8bbe\u5907&#xff08;\u9700\u5148\u901a","og_url":"https:\/\/www.wsisp.com\/helps\/70131.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-01T07:35:58+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/70131.html","url":"https:\/\/www.wsisp.com\/helps\/70131.html","name":"Android \u65e5\u5e38\u5f00\u53d1Adb\u5e38\u7528\u547d\u4ee4\u9644\u6863 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-01T07:35:58+00:00","dateModified":"2026-02-01T07:35:58+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/70131.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/70131.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/70131.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Android \u65e5\u5e38\u5f00\u53d1Adb\u5e38\u7528\u547d\u4ee4\u9644\u6863"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/70131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=70131"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/70131\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=70131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=70131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=70131"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=70131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}