Samsung Galaxy Z Flip7 FE USB 调试 - ADB 调试

Samsung Galaxy Z Flip7 FE USB 调试 - ADB 调试

  • 1. 开发者模式
  • 2. USB debugging (USB 调试)
  • 3. 配置 Windows 防火墙
  • 4. ADB 连接设备
  • 5. Windows 启动 adb server
  • 6. 其他主机用户连接 devices
  • 7. Troubleshooting 1
  • 8. Troubleshooting 2
  • References

1. 开发者模式

Settings (设置) -> About phone (关于手机) -> Software information (软件信息) -> Build number (编译编号)

连续点击Build number (编译编号)7 次进入开发者模式

2. USB debugging (USB 调试)

Settings (设置) -> Developer options (开发人员选项) -> USB debugging (USB 调试)

  1. USB 调试 - ENABLE (连接 USB 后开启调试模式)
  2. 连接 USB 时总是弹出提示 - ENABLE
  3. 选择 USB 配置 - MTP (多媒体传输)

3. 配置 Windows 防火墙

Windows 控制面板 -> 系统和安全 -> Windows Defender 防火墙

点击左侧 “允许应用或功能通过 Windows 防火墙”,点击 “更改设置”,勾选 adb 对应的 “专用” 和 “公用” 两个复选框。

4. ADB 连接设备

Microsoft Windows [版本 10.0.19045.6466] (c) Microsoft Corporation。保留所有权利。 C:\Users\cheng>adb kill-server cannot connect to daemon at tcp:5037: cannot connect to 127.0.0.1:5037: 由于目标计算机积极拒绝,无法连接。 (10061) C:\Users\cheng>adb start-server * daemon not running; starting now at tcp:5037 * daemon started successfully C:\Users\cheng>adb kill-server C:\Users\cheng>adb start-server * daemon not running; starting now at tcp:5037 * daemon started successfully C:\Users\cheng>adb devices List of devices attached R5GL50ZEVVR device C:\Users\cheng> C:\Users\cheng>adb shell b7r:/ $ exit C:\Users\cheng>

adb devices [-l]- list connected devices (-lfor long output)
列出链接的设备 (-lfor long output)

C:\Users\cheng>adb devices -l List of devices attached R5GL50ZEVVR device product:b7rzcx model:SM_F7610 device:b7r transport_id:1 C:\Users\cheng>

adb kill-server- kill the server if it is running

C:\Users\cheng>adb kill-server C:\Users\cheng> C:\Users\cheng>adb kill-server cannot connect to daemon at tcp:5037: cannot connect to 127.0.0.1:5037: 由于目标计算机积极拒绝,无法连接。 (10061) C:\Users\cheng> C:\Users\cheng>adb devices * daemon not running; starting now at tcp:5037 * daemon started successfully List of devices attached R5GL50ZEVVR device C:\Users\cheng> C:\Users\cheng>adb kill-server C:\Users\cheng>

5. Windows 启动 adb server

adb kill-server
adb -a -P 5037 nodaemon server
或者
adb kill-server
adb -a nodaemon server

-a- listen on all network interfaces, not just localhost - 侦听所有网络接口,而不仅仅是本地主机
-H- name of adb server host [default=localhost]
-P- port of adb server [default=5037]

adb -a nodaemon server- 启动守护进程后,其他用户可以通过adb -H 192.168.*.*** devicesadb -H 192.168.*.*** shell访问192.168.*.***挂载的手机。

NOTE: Linux 和 Windows 中的 adb 版本要完全相同。

Microsoft Windows [版本 10.0.19041.450] (c) 2020 Microsoft Corporation. 保留所有权利。 C:\Users\cheng>adb kill-server C:\Users\cheng>adb -a nodaemon server adb I 04-30 19:53:44 15496 12640 auth.cpp:417] adb_auth_init... adb I 04-30 19:53:44 15496 12640 auth.cpp:152] loaded new key from 'C:\Users\cheng\.android\adbkey' with fingerprint C003CF5AD89F690A49BB31A1FB606378F31F0772F9ED77D67B67921478710B0E adb I 04-30 19:53:44 15496 10268 transport.cpp:325] FFKDU17A28006357: read thread spawning adb I 04-30 19:53:44 15496 13656 transport.cpp:297] FFKDU17A28006357: write thread spawning adb I 04-30 19:53:44 15496 12640 transport.cpp:1527] fetching keys for transport FFKDU17A28006357 adb I 04-30 19:53:44 15496 12640 auth.cpp:469] Calling send_auth_response adb I 04-30 19:53:44 15496 12640 adb.cpp:124] FFKDU17A28006357: offline

对于 platform-tools_r37.0.0-win.zip 版本,执行后光标闪烁但无报错,说明服务‌已成功启动‌,此时需‌保持该窗口开启。

adb -a nodaemon server执行前,先执行adb kill-server

Microsoft Windows [版本 10.0.19041.450] (c) 2020 Microsoft Corporation. 保留所有权利。 C:\Users\cheng>adb devices List of devices attached FFKDU17A28006357 device C:\Users\cheng> C:\Users\cheng>adb -a nodaemon server adb F 08-29 18:13:43 14532 12896 main.cpp:153] could not install *smartsocket* listener: cannot bind to 0.0.0.0:5037: 閫氬父姣忎釜濂楁帴瀛楀湴鍧€(鍗忚/缃戠粶鍦板潃/绔彛)鍙厑璁镐娇鐢ㄤ竴娆°€?(10048) C:\Users\cheng> C:\Users\cheng>adb kill-server C:\Users\cheng> C:\Users\cheng>adb -a nodaemon server adb I 04-30 19:53:44 15496 12640 auth.cpp:417] adb_auth_init... adb I 04-30 19:53:44 15496 12640 auth.cpp:152] loaded new key from 'C:\Users\cheng\.android\adbkey' with fingerprint C003CF5AD89F690A49BB31A1FB606378F31F0772F9ED77D67B67921478710B0E adb I 04-30 19:53:44 15496 10268 transport.cpp:325] FFKDU17A28006357: read thread spawning adb I 04-30 19:53:44 15496 13656 transport.cpp:297] FFKDU17A28006357: write thread spawning adb I 04-30 19:53:44 15496 12640 transport.cpp:1527] fetching keys for transport FFKDU17A28006357 adb I 04-30 19:53:44 15496 12640 auth.cpp:469] Calling send_auth_response adb I 04-30 19:53:44 15496 12640 adb.cpp:124] FFKDU17A28006357: offline

6. 其他主机用户连接 devices

(base) yongqiang@yongqiang:~$ adb kill-server (base) yongqiang@yongqiang:~$ adb -H 172.28.32.1 devices List of devices attached R5GL50ZEVVR device (base) yongqiang@yongqiang:~$ adb -H 172.28.32.1 shell b7r:/ $ cd /data/local/tmp/ b7r:/data/local/tmp $ ls -l total 0 b7r:/data/local/tmp $ exit (base) yongqiang@yongqiang:~$

7. Troubleshooting 1

1.netstat -ano | findstr "5037"

进程 15496 占用了 5037 端口。

C:\Users\cheng>netstat -ano | findstr "5037" TCP 0.0.0.0:5037 0.0.0.0:0 LISTENING 15496 C:\Users\cheng>

2.tasklist | findstr "15496"

使用命令查看这个进程是由哪个程序的adb.exe创建了 15496 进程。

C:\Users\cheng>tasklist | findstr "15496" adb.exe 15496 Console 7 10,704 K C:\Users\cheng>

3.taskkill /f /pid 15496

结束掉 15496 进程。

8. Troubleshooting 2

Microsoft Windows [版本 10.0.19043.1645] (c) Microsoft Corporation。保留所有权利。 C:\Users\cheng>adb kill-server cannot connect to daemon at tcp:5037: cannot connect to 127.0.0.1:5037: 由于目标计算机积极拒绝,无法连接。 (10061) C:\Users\cheng>adb -a nodaemon server adb I 05-04 17:12:43 16096 21124 auth.cpp:417] adb_auth_init... adb I 05-04 17:12:43 16096 21124 auth.cpp:152] loaded new key from 'C:\Users\cheng\.android\adbkey' with fingerprint C003CF5AD89F690A49BB31A1FB606378F31F0772F9ED77D67B67921478710B0E

如果启动 adb server 时出现上述 log,请查看2. USB debugging (USB 调试)进行设置。

References

[1] Yongqiang Cheng (程永强), https://yongqiang.blog.csdn.net/