找回密码
 立即注册
查看: 426|回复: 0

Unity:配置Android手机进行WiFi调试

[复制链接]
发表于 2021-12-7 12:22 | 显示全部楼层 |阅读模式
为了让Unity编译的apk包安装到手机,我们需要通过USB连接手机和PC。但应用测试常常需要移动手机,所以有线带来了非常大的束缚。同时频繁插拔USB容易导致USB接口损坏,而且长期给手机充放电也会损坏手机的电池。那么,能通过WiFi连接手机进行调试吗?
答案是肯定的。
工具准备:adb
是一个应用工具,可以在Android SDK安装目录下的platform-tools子目录下找到它。一般是:
  C:\Users\xxx\AppData\Local\Android\Sdk
使用时在该目录打开cmd即可执行相应命令(或者将该目录加入系统环境变量,从而全局可用)。
<hr/>

  • ( 可选 )将手机通过USB连接到电脑,设置连接端口。设置完后即可断开连接。
adb tcpip 8888(默认是5555)

  • 将手机与电脑连接到同一个wifi,保证二者在同一个子网
  • 通过adb命令连接手机。查看wifi详细信息即可找到手机IP地址。
adb connect 手机IP:5555

  • ( 可选 )断开连接命令
adb disconnect 手机IP:5555
<hr/>Q:adb server version (x) doesn't match this client (x); killing...
A:Normally,this error means there are two Android SDKs in your computer. Try to find another adb of Unity in
    Unity DIR\2020.3.23f1c1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\platform-tools
Ensure that the versions of them are the same...
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-9-23 01:36 , Processed in 0.139887 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表