10

Scrcpy投屏真机到电脑 并集成DevEco真机调试 Mac系统下

 2 years ago
source link: https://segmentfault.com/a/1190000040065559
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Scrcpy投屏真机到电脑 并集成DevEco真机调试 Mac系统下

发布于 15 分钟前

开发环境:

  电脑: Mac mini主机

  开发工具: DevEco Studio 2.1 Beta4

  第三方软件: Scrcpy android-platform-tools

  1. 首先检查电脑有没有安装brew
Army-Mac-mini-2:~ army$ brew -v
Homebrew 3.1.5
Homebrew/homebrew-core (git revision 4c638b0758; last commit 2021-04-30)
Homebrew/homebrew-cask (git revision bdb866f4fc; last commit 2021-04-30)

如果没有, 执行下面安装命令:

Army-Mac-mini-2:~ army$ /usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
  1. 安装Scrcpy android-platform-tools软件
Army-Mac-mini-2:~ army$  brew install scrcpy
Army-Mac-mini-2:~ army$  brew install --cask android-platform-tools
  1. 确保PC和手机在同一Wifi中
  1. 手机先通过USB与PC相连
  1. 在PC上运行 adb tcpip 服务端口,如端口为6666

先查看电脑上有哪些设备了

Army-Mac-mini-2:~ army$  adb devices
List of devices attached
XIU0220C17029368    device

打开服务端口6666

Army-Mac-mini-2:~ army$  adb -s XIU0220C17029368 tcpip 6666
  1. 拔下你的设备,断开USB连接
  1. 在PC上运行 adb connect 手机IP:服务端口
Army-Mac-mini-2:~ army$  adb connect 192.168.3.168:6666
  1. 通过手机IP地址+服务端口号连接上手机
Army-Mac-mini-2:~ army$  scrcpy -s 192.168.3.168:6666
  1. 生成调试证书, 请参考官方文档
    https://developer.harmonyos.c...
  2. 获取UDID时, 如果电脑连接了多个设备,先断开其它连接的设备,再执行命令获取
Army-Mac-mini-2:~ army$  adb disconnect 192.168.3.211:5555
Army-Mac-mini-2:~ army$  adb shell bm get -udid
2EW13B922B671A48C802168D245C6B5B60312OIK3D6B90678S1534B420422218

安装Scrcpy软件和android-platform-tools平台软件

申请调测证书和Profile (详情看官方文档)

scrcpy连接真机到电脑上

DevEco Studio调试选择上面连接上的真机.

电脑重启后, 重新投屏真机到电脑上,使用下面命令就行:

Army-Mac-mini-2:~ army$ adb connect 192.168.3.168:6666

Army-Mac-mini-2:~ army$ scrcpy -s 192.168.3.168:6666

最后来张截图:

原文链接:
https://developer.huawei.com/...
原作者:野狼_16叔


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK